How make hover effect like in css with panda GUI

Hi
I use(try use) this engine only week. I would like make a animated button that start animation when cursor is on it but I don’t have idea how make it

self.frame2 = DirectFrame(
frameSize=(-1, 1, -1, 1), # Rozmiar ramki
frameColor=(0, 1, 0, 1), # Początkowy kolor ramki
)

    # Ustawienie stanu ramki i związanych z nim funkcji hover_command
    self.frame2['state'] = DGG.NORMAL
    self.frame2.bind(DGG.WITHOUT, self.hover_command, [False])
    self.frame2.bind(DGG.WITHIN, self.hover_command, [True])

def hover_command(self,hover, frame):
    if hover:
        self.frame2['frameColor'] = (1, 0, 0, 1)  
    else:
        self.frame2['frameColor'] = (0, 1, 0, 1)  

I finally made it, after 3 hours searching. Finally I can go sleep

Hi,
just a little hint in case you haven’t seen it yet, there is an actual button available in Panda3Ds GUI system which does support changing colors on hover and more.

For example:

btn = DirectButton(
    text="my Button",
    scale=0.25,
    frameColor=[(1,0,0,1),(1,0,0,1),(0,1,0,1),(1,0,0,1)])

More information can be found here:
https://docs.panda3d.org/1.10/python/programming/gui/directgui/directbutton