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.
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()
.-
draw
()[source]¶ Draws the submenu and its background.
Note that this leaves the OpenGL state set to 2d drawing.
-
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
andmaterial
may be given, resulting in a background that looks similar to buttons.Lastly, the string
"blank"
may be passed to skip background drawing.
-