pyglet.gui
Classes
- class WidgetBase(x, y, width, height)
Attributes
- class PushButton(x, y, pressed, depressed, hover=None, batch=None, group=None)
Bases:
WidgetBase
Instance 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.
- on_mouse_drag(x, y, dx, dy, buttons, modifiers)
- on_mouse_motion(x, y, dx, dy)
- on_mouse_press(x, y, buttons, modifiers)
- on_mouse_release(x, y, buttons, modifiers)
- update_groups(order)
- event_types = ['on_press', 'on_release', 'on_toggle']
- property value
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.
- class ToggleButton(x, y, pressed, depressed, hover=None, batch=None, group=None)
Bases:
PushButton
Instance of a toggle button.
Triggers the event ‘on_toggle’ when the mouse is pressed or released.
- on_mouse_press(x, y, buttons, modifiers)
- on_mouse_release(x, y, buttons, modifiers)
- class Slider(x, y, base, knob, edge=0, batch=None, group=None)
Bases:
WidgetBase
Instance 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.
- on_mouse_drag(x, y, dx, dy, buttons, modifiers)
- on_mouse_press(x, y, buttons, modifiers)
- on_mouse_release(x, y, buttons, modifiers)
- on_mouse_scroll(x, y, scroll_x, scroll_y)
- update_groups(order)
- event_types = ['on_change']
- property value
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.
- class TextEntry(text, x, y, width, color=(255, 255, 255, 255), text_color=(0, 0, 0, 255), caret_color=(0, 0, 0, 255), batch=None, group=None)
Bases:
WidgetBase
Instance of a text entry widget.
Allows the user to enter and submit text.
- on_commit(text)
- on_mouse_drag(x, y, dx, dy, buttons, modifiers)
- on_mouse_motion(x, y, dx, dy)
- on_mouse_press(x, y, buttons, modifiers)
- on_text(text)
- on_text_motion(motion)
- on_text_motion_select(motion)
- update_groups(order)
- event_types = ['on_commit']
- property value
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.