peng3d.gui - 2D Widget based GUI System

class peng3d.gui.GUIMenu(name, window, peng)[source]

peng3d.menu.Menu subclass adding 2D GUI Support.

Note that widgets are not managed directly by this class, but rather by each SubMenu.

addSubMenu(submenu)[source]

Adds a SubMenu to this Menu.

Note that nothing will be displayed unless a submenu is activated.

changeSubMenu(submenu)[source]

Changes the submenu that is displayed.

Raises:ValueError – if the name was not previously registered
draw()[source]

Draws each menu layer and the active submenu.

Note that the layers are drawn first and may be overridden by the submenu and widgets.

submenu

Property containing the SubMenu instance that is currently active.

class peng3d.gui.SubMenu(name, menu, window, peng)[source]

Sub Menu of the GUI system.

Each instance must be registered with their menu to work properly, see GUIMenu.addSubMenu().

Actions supported by default:

enter is triggered everytime the on_enter() method has been called.

exit is triggered everytime the on_exit() method has been called.

addWidget(widget)[source]

Adds a widget to this submenu.

delWidget(widget)[source]

Deletes the widget by the given name.

Note that this feature is currently experimental as there seems to be a memory leak with this method.

draw()[source]

Draws the submenu and its background.

Note that this leaves the OpenGL state set to 2d drawing.

getWidget(name)[source]

Returns the widget with the given name.

setBackground(bg)[source]

Sets the background of the submenu.

The background may be a RGB or RGBA color to fill the background with.

Alternatively, a peng3d.layer.Layer instance or other object with a .draw() method may be supplied. It is also possible to supply any other method or function that will get called.

Also, the strings flat, gradient, oldshadow and material may be given, resulting in a background that looks similar to buttons.

Lastly, the string "blank" may be passed to skip background drawing.

class peng3d.gui.GUILayer(name, menu, window, peng)[source]

Hybrid of GUIMenu and peng3d.layer.Layer2D.

This class allows you to create Head-Up Displays and other overlays easily.

draw()[source]

Draws the Menu.