vedo
vedo copied to clipboard
button clicks are triggered twice
Hi Marco, Hope everything is great with you. By the way the new update looks great. Thank you very much for all the work under this library. I cant even tell how it is helping me.
With this new update I came to a bug I guess. The button click is triggered twice when there is a callback for mouse click. If I change the enable_picking=False for mouse click then the button click is triggered once but this time mouse clicks cannot pick anything on the screen. Do you think if this is bug? If not then I will try to create a workaround for my cases. thanks in advance for your time and energy Regards
from vedo import Plotter, Mesh, dataurl, printc
def buttonfunc(evt,arg):
print("timessss")
mesh = Mesh(dataurl+"magnolia.vtk").c("violet").flat()
plt = Plotter(axes=11)
bu = plt.add_button(
buttonfunc,
pos=(0.7, 0.05), # x,y fraction from bottom left corner
states=["click to hide", "click to show"], # text for each state
c=["w", "w"], # font color for each state
bc=["dg", "dv"], # background color for each state
font="courier", # font type
size=25, # font size
bold=True, # bold font
italic=False, # non-italic font style
)
def _on_left_click_pressed(arg):
print("left_click_times")
return
plt.add_callback("LeftButtonPress", _on_left_click_pressed)
plt.show(mesh, __doc__).close()
Hi Umut, most definitely a bug, and a pretty nasty one... I will need some more time to fix it! Thanks for drawing my attention to it.
Hi Marco, thanks for your kind reply. no problem at all, take your time. I couldnt find the reason in library but I have done a small work around in my code to eliminate it.