peng3d.gui.container - GUI Container and Scrolling system

class peng3d.gui.container.Container(name, submenu, window, peng, pos=None, size=None)[source]

Main class of the container system.

This widget may contain other widgets, limiting the childs to only draw within the defined bounds. Additionally, the given position will also act as a offset, making the child coordinates relative to the parent.

This Class is a subclass of peng3d.gui.widgets.Widget but also exhibits part of the API of peng3d.gui.SubMenu.

addWidget(widget)[source]

Adds a widget to this container.

Note that trying to add the Container to itself will be ignored.

draw()[source]

Draws the submenu and its background.

Note that this leaves the OpenGL state set to 2d drawing and may modify the stencil settings and buffer.

getWidget(name)[source]

Returns the widget with the given name.

on_enter(old)[source]

Dummy method defined for compatibility with peng3d.gui.SubMenu, simply does nothing.

on_exit(new)[source]

Dummy method defined for compatibility with peng3d.gui.SubMenu, simply does nothing.

redraw()[source]

Redraws the background and any child widgets.

setBackground(bg)[source]

Sets the background of the Container.

Similar to peng3d.gui.SubMenu.setBackground(), but only effects the region covered by the Container.

class peng3d.gui.container.ScrollableContainer(name, submenu, window, peng, pos=None, size=None, scrollbar_width=12, borderstyle='flat', content_height=100)[source]

Subclass of Container allowing for scrolling its content.

The scrollbar currently is always on the right side and simply consists of a peng3d.gui.slider.VerticalSlider.

scrollbar_width and borderstyle will be passed to the scrollbar.

content_height refers to the maximum offset the user can scroll to.

The content height may be changed, but manually calling redraw() will be necessary.

redraw()[source]

Redraws the background and contents, including scrollbar.

This method will also check the scrollbar for any movement and will be automatically called on movement of the slider.

class peng3d.gui.container.ContainerButtonBackground(widget, border=[4, 4], borderstyle='flat')[source]

Background class used to render the background of containers using a button style.

Mostly identical with ButtonBackground with added compatibility for containers.