from direct.gui.DirectDialog import DirectDialog, OkCancelDialog, OkDialog, RetryCancelDialog, YesNoCancelDialog, YesNoDialog, cleanupDialog, findDialog

This module defines various dialog windows for the DirectGUI system.

See the DirectDialog page in the programming manual for a more in-depth explanation and an example of how to use this class.

Inheritance diagram

Inheritance diagram of direct.gui.DirectDialog

class DirectDialog(parent=None, **kw)[source]

Bases: direct.gui.DirectFrame.DirectFrame

AllDialogs = {}
PanelIndex = 0
__init__(self, parent=None, **kw)[source]

Creates a popup dialog to alert and/or interact with user. Some of the main keywords that can be used to customize the dialog:

  • text (str) – Text message/query displayed to user

  • geom – Geometry to be displayed in dialog

  • buttonTextList – List of text to show on each button

  • buttonGeomList – List of geometry to show on each button

  • buttonImageList – List of images to show on each button

  • buttonValueList – List of values sent to dialog command for each button. If value is [] then the ordinal rank of the button is used as its value.

  • buttonHotKeyList – List of hotkeys to bind to each button. Typing the hotkey is equivalent to pressing the corresponding button.

  • suppressKeys – Set to true if you wish to suppress keys (i.e. Dialog eats key event), false if you wish Dialog to pass along key event.

  • buttonSize – 4-tuple used to specify custom size for each button (to make bigger then geom/text for example)

  • pad – Space between border and interior graphics

  • topPad – Extra space added above text/geom/image

  • midPad – Extra space added between text/buttons

  • sidePad – Extra space added to either side of text/buttons

  • buttonPadSF – Scale factor used to expand/contract button horizontal spacing

  • command – Callback command used when a button is pressed. Value supplied to command depends on values in buttonValueList.


The number of buttons on the dialog depends on the maximum length of any button[Text|Geom|Image|Value]List specified. Values of None are substituted for lists that are shorter than the max length

buttonCommand(self, value, event=None)[source]
setMessage(self, message)[source]
class OkCancelDialog(parent=None, **kw)[source]

Bases: direct.gui.DirectDialog.DirectDialog

__init__(self, parent=None, **kw)[source]
class OkDialog(parent=None, **kw)[source]

Bases: direct.gui.DirectDialog.DirectDialog

__init__(self, parent=None, **kw)[source]
class RetryCancelDialog(parent=None, **kw)[source]

Bases: direct.gui.DirectDialog.DirectDialog

__init__(self, parent=None, **kw)[source]
class YesNoCancelDialog(parent=None, **kw)[source]

Bases: direct.gui.DirectDialog.DirectDialog

__init__(self, parent=None, **kw)[source]
class YesNoDialog(parent=None, **kw)[source]

Bases: direct.gui.DirectDialog.DirectDialog

__init__(self, parent=None, **kw)[source]

cleanupPanel(string uniqueName)

Cleans up (removes) the panel with the given uniqueName. This may be useful when some panels know about each other and know that opening panel A should automatically close panel B, for instance.


Returns the panel whose uniqueName is given. This is mainly useful for debugging, to get a pointer to the current onscreen panel of a particular type.