pyglet.gui
Classes
- class WidgetBase
Bases:
EventDispatcherThe base of all widgets.
Attributes
- x
X coordinate of the widget.
- y
Y coordinate of the widget.
- width
Width of the widget.
- height
Height of the widget.
- aabb
Bounding box of the widget.
The “left”, “bottom”, “right”, and “top” coordinates of the widget. This is expressed as (x, y, x + width, y + height).
- classmethod __new__(*args, **kwargs)
- class PushButton
Bases:
WidgetBaseInstance of a push button.
Triggers the event ‘on_press’ when it is clicked by the mouse. Triggers the event ‘on_release’ when the mouse is released.
- property value: bool
Whether the button is pressed or not.
- class ToggleButton
Bases:
PushButtonInstance of a toggle button.
Triggers the event ‘on_toggle’ when the mouse is pressed or released.
- class Slider
Bases:
WidgetBaseInstance of a slider made of a base and a knob image.
Triggers the event ‘on_change’ when the knob position is changed. The knob position can be changed by dragging with the mouse, or scrolling the mouse wheel.
- property value: float
Query or set the Widget’s value.
This property allows you to set the value of a Widget directly, without any user input. This could be used, for example, to restore Widgets to a previous state, or if some event in your program is meant to naturally change the same value that the Widget controls. Note that events are not dispatched when changing this property directly.
- class TextEntry
Bases:
WidgetBaseInstance of a text entry widget. Allows the user to enter and submit text.
Triggers the event ‘on_commit’, when the user hits the Enter or Return key. The current text string is passed along with the event.
- property focus: bool
- property height: int
Height of the widget.
- property value: str
Query or set the Widget’s value.
This property allows you to set the value of a Widget directly, without any user input. This could be used, for example, to restore Widgets to a previous state, or if some event in your program is meant to naturally change the same value that the Widget controls. Note that events are not dispatched when changing this property directly.
- property width: int
Width of the widget.