Toggling DirectFrame Visibility

I have a DirectFrame containing some controls, and would like to show or hide that frame based on a button click. I have looked through the direct.gui class hierarchy and haven’t found anything that controls visibility. Is there a way to change the visibility to DirectGUI elements, or does it need to be done another way (i.e. set the width of DirectFrame to 0)?

DirectGUI widgets are just nodes in the scene-graph, like any other, and indeed the classes that you instantiate in Python inherit from NodePath. As such, you can just call “show” and “hide” on DirectGUI widgets, just as with any other node.

e.g. Something like this:

    self.frame = DirectFrame(<parameters here>)

def buttonClicked(self):
1 Like

As always, thanks for your help. I ended up with the following code to toggle the visibility once I understood that NodePath inheritance.

if self.parameters_panel_frame.isHidden():
1 Like