DirectGUI: Mouse Issues


I am trying to make a GUI editor so-to-speak. Basically I have a toolbox at the bottom of the screen with many buttons. This is a DirectFrame with many DirectFrames parented to it. How do I make it so that I can click these custom ‘buttons’ i have created? I basically want to be able to test if the mouse is within a region of the screen. Any ideas?

Thanks in advance

Any DirectGui object, including a DirectFrame, can be made clickable by setting its state to “normal” (as opposed to the default, which is “disabled” for a DirectFrame):

f = DirectFrame(..., state = DGG.NORMAL)


f['state'] = DGG.NORMAL


how would you test if the button/DirectFrame had been clicked on?

You can bind the click event to a function like this:

f.bind(DGG.B1CLICK, self.commandFunc)

The specified function will be called when the user clicks on the frame.