button rollover command

I want a function to run when a button is clicked, but also another function when the cursor rolls over the button. How can I do that?

hi, as long as you have imported the DGG stuff, do this:

from direct.gui.DirectGui import DGG # import DIrectGuiGlobals (DGG)

mybutton.bind(DGG.ENTER, onrolloverfunction)

that means when the mouse enters the frame, you can use DGG.EXIT if you want a callback when the mouse leaves the frame of the button, there are also other calbacks such as DGG.B1PRESS, etc…

hope that helps, GL!

thats great