vedo
                                
                                 vedo copied to clipboard
                                
                                    vedo copied to clipboard
                            
                            
                            
                        hover_legend Triggers Button
I've run into an issue with using the hover_legend and a button in the same plot. If I add both of them, the button function is triggerd constantly while im hovering the button. As I'm new to using this wonderful library, I'm not sure if this is a but or if there is something I'm missing. I looked for the option to exclude objects from the hover_legend or limit it to specific objects but didn't find anything.
I added the hover_legend to the Button example code to show the issue.
def buttonfunc(obj, ename):
    mesh.alpha(1 - mesh.alpha())  # toggle mesh transparency
    bu.switch()                   # change to next status
    printc(bu.status(), box="_", dim=True)
# Load a mesh and set its color to violet
mesh = Mesh(dataurl+"magnolia.vtk").c("violet").flat()
# Create an instance of the Plotter class with axes style-11 enabled
plt = Plotter(axes=11)
# Add a button to the plotter with buttonfunc as the callback function
bu = plt.add_button(
    buttonfunc,
    pos=(0.7, 0.1),   # 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=30,          # font size
    bold=True,        # bold font
    italic=False,     # non-italic font style
)
# Show the mesh, docstring, and button in the plot
plt.add_hover_legend().show(mesh, __doc__).close()
Thanks @MarkFerr for reporting - it's definitely a bug, I will have time to look into it in the weekend!
Hey, I indeed looked into it and the reason is that Button and hover legend both invoke a "PickEvent" so unfortunately they cannot be disentangled at present unless a brand new interactor is written... I'm afraid this will remain as a limitation of the library :( Let's keep the issue open so that I remember about it.
Meanwhile you may want to explore other ways of visualizing auxiliary info like eg flagpole(), flagpost(), caption() etc..
Thanks for the update! :)