Get current state of a DirectButton

Dear fellow Panda3d users,

Does anybody know whether it’s possible to get the state number/ current state of a DirectButton to detect whether it is in the roll over state?

My objective is to create information tags when the mouse hovers over a button for a certain amount of time.

Maybe somebody even knows a way to get the gui nodepath the mouse is hovering over? Using the collision system would work I guess but it seems a bit redundant as the “collision” is already detected by the DirectButton.

Thank a lot!

One way I know is to call my_button.guiItem.getState() and check if it returns 2.

Perhaps my_button.stateNodePath[state_number] is what you’re looking for.
But you might prefer to use my_button.bind(DGG.ENTER, show_tooltip) and my_button.bind(DGG.EXIT, hide_tooltip) for this.

Ah thanks for the help, everything worked out with the .bind which is a convenient way to achieve this!