podgorskiy / bimpy

imgui for python
https://podgorskiy.github.io/bimpy/
MIT License
202 stars 33 forks source link

Function overridding for ImageButton #28

Closed strixnivea closed 4 years ago

strixnivea commented 4 years ago

I was having trouble getting the ImageButton to display an image, so I made a few more helpers to load images more like the PIL example. I also commented out the default &ImGui::ImageButton line and tried to recreate it with the last of the 4 functions that I added

strixnivea commented 4 years ago

Simplest usage looks like this:

image = Image.open("test.png")

im = bimpy.Image(image)

while(not ctx.should_close()): with ctx: bimpy.text("Display PIL Image Button")

    bimpy.image_button(im, 1, bimpy.Vec4(0, 0, 0, 1), bimpy.Vec4(1, 1, 1, 1))
strixnivea commented 4 years ago

Found that the overridden functions were not returning the 'click' bool for button functionality