GUI Style

class arcade.gui.UIStyleBase[source]

Bases:

Base class for styles to ensure a general interface and implement additional magic.

Support dict like access syntax.

A styled widget should own a dataclass, which subclasses this class

get(key, default: str) str[source]
get(key, default: Any) Any

Get a value from the style, if not available return default.

class arcade.gui.UIStyledWidget(*, style: dict[str, StyleRef], **kwargs)[source]

Bases: UIWidget, Generic[StyleRef]

Baseclass for widgets to be styled.

A styled widget should own a dataclass, which subclasses UIStyleBase. The style dict should contain the different states of the widget.

The widget should implement py:method::get_current_state(), which should return the current state of the widget.

Parameters:
  • style – A mapping of states to styles

  • **kwargs – passed to UIWidget

abstract get_current_state() str[source]

Return the current state of the widget. These should be contained in the style dict.

Well known states: - normal - hover - press - disabled

get_current_style() StyleRef | None[source]

Return style based on any state of the widget

style

Property that represents a dict.

Only dict are allowed. Any other classes are forbidden.