GUI Events

class arcade.gui.UIEvent(source: Any)[source]

Bases:

An event created by the GUI system.

Can be passed as follows:

widget.dispatch("on_event", event)

An event always has a source. This is the UIManager for general input events, but will be the specific widget in case of events like click events.

Parameters:

source – The source of the event.

source: Any
class arcade.gui.UIMouseEvent(source: Any, x: int, y: int)[source]

Bases: UIEvent

Base class for all UI mouse events.

Parameters:
  • x – The x coordinate of the mouse.

  • y – The y coordinate of the mouse.

property pos: Vec2

Return the position as tuple (x, y)

x: int
y: int
class arcade.gui.UIMouseMovementEvent(source: Any, x: int, y: int, dx: int, dy: int)[source]

Bases: UIMouseEvent

Triggered when the mouse is moved.

Parameters:
  • dx – The change in x coordinate.

  • dy – The change in y coordinate.

dx: int
dy: int
class arcade.gui.UIMousePressEvent(source: Any, x: int, y: int, button: int, modifiers: int)[source]

Bases: UIMouseEvent

Triggered when a mouse button(left, right, middle) is pressed.

Parameters:
  • button – The button pressed.

  • modifiers – The modifiers pressed.

button: int
modifiers: int
class arcade.gui.UIMouseDragEvent(source: Any, x: int, y: int, dx: int, dy: int, buttons: int, modifiers: int)[source]

Bases: UIMouseEvent

Triggered when the mouse moves while one of its buttons being pressed.

Parameters:
  • dx – The change in x coordinate.

  • dy – The change in y coordinate.

  • buttons – The buttons pressed.

  • modifiers – The modifiers pressed.

buttons: int
dx: int
dy: int
modifiers: int
class arcade.gui.UIMouseReleaseEvent(source: Any, x: int, y: int, button: int, modifiers: int)[source]

Bases: UIMouseEvent

Triggered when a mouse button is released.

Parameters:
  • button – The button released.

  • modifiers – The modifiers pressed

button: int
modifiers: int
class arcade.gui.UIMouseScrollEvent(source: Any, x: int, y: int, scroll_x: int, scroll_y: int)[source]

Bases: UIMouseEvent

Triggered by rotating the scroll wheel on the mouse.

Parameters:
  • scroll_x – The horizontal scroll amount.

  • scroll_y – The vertical scroll

scroll_x: int
scroll_y: int
class arcade.gui.UIKeyEvent(source: Any, symbol: int, modifiers: int)[source]

Bases: UIEvent

Base class for all keyboard-centric UI events.

Parameters:
  • symbol – The key pressed.

  • modifiers – The modifiers pressed.

modifiers: int
symbol: int
class arcade.gui.UIKeyPressEvent(source: Any, symbol: int, modifiers: int)[source]

Bases: UIKeyEvent

Triggered when a key is pressed.

class arcade.gui.UIKeyReleaseEvent(source: Any, symbol: int, modifiers: int)[source]

Bases: UIKeyEvent

Triggered when a key is released.

class arcade.gui.UITextEvent(source: Any)[source]

Bases: UIEvent

Base class for text-related events.

It holds no data of its own.

class arcade.gui.UITextInputEvent(source: Any, text: str)[source]

Bases: UITextEvent

Triggered whenever the user inputs any text.

Usually, this will be after UIKeyPressEvent and before a UIKeyReleaseEvent. It may also occur when:

  • the user holds down a key to repeat letters or spaces

  • a platform-specific input method, such as pen input on a tablet PC

To learn more, see pyglet’s relevant documentation.

Parameters:

text – The text inputted. Often a single character.

text: str
class arcade.gui.UITextMotionEvent(source: Any, motion: Any)[source]

Bases: UITextEvent

Triggered when text cursor moves.

Parameters:

motion – The motion of the cursor

motion: Any
class arcade.gui.UITextMotionSelectEvent(source: Any, selection: Any)[source]

Bases: UITextEvent

Triggered when the text cursor moves selecting the text with it.

Parameters:

selection – The selection of the cursor

selection: Any
class arcade.gui.UIOnClickEvent(source: Any, x: int, y: int, button: int, modifiers: int)[source]

Bases: UIMouseEvent

Triggered when a widget is clicked.

Parameters:
  • button – The button clicked.

  • modifiers – The modifiers pressed.

button: int
modifiers: int
class arcade.gui.UIOnUpdateEvent(source: Any, dt: int)[source]

Bases: UIEvent

Arcade on_update callback passed as UIEvent.

Parameters:

dt – Time since last update

dt: int
class arcade.gui.UIOnChangeEvent(source: Any, old_value: Any, new_value: Any)[source]

Bases: UIEvent

Value of a widget changed.

Parameters:
  • old_value – The old value.

  • new_value – The new value.

new_value: Any
old_value: Any
class arcade.gui.UIOnActionEvent(source: Any, action: Any)[source]

Bases: UIEvent

Notification about an action.

Parameters:

action – Value describing the action, mostly a string

action: Any