bind() doesn't work on DirectFrame?

In the code below a mouseclick on the green DirectButton triggers the DGG.B1PRESS event appropriately, but the same event doesn’t seem to be triggered when I click on the red DirectFrame. As both objects inherit through DirectGuiWidget from DirectGuiBase they both support the bind() method and the script returns no error, but somehow with DirectFrame it appears that the event is either ignored or never occurs. How come? I can’t seem to find a class that overrides the bind() method to silence it…


from direct.directbase.DirectStart import *
from direct.gui.DirectGui import *

def printHello(argument):

aButton = DirectButton(frameSize=(0, 0.1, 0, 0.1), frameColor=(0, 1, 0, 1), pos=(-0.1, 0.0, 0.0))
aFrame  = DirectFrame(frameSize=(0, 0.1, 0, 0.1), frameColor=(1, 0, 0, 1), pos=(0.1, 0.0, 0.0))

aButton.bind(DGG.B1PRESS, printHello)
aFrame.bind(DGG.B1PRESS, printHello)


A DirectFrame is disabled by default, which means it does not process any mouse clicks. If you want to listen for clicks on a DirectFrame, you have to enable it by passing state = DGG.NORMAL to the constructor.


Aaaah! Thank you!!!