gale.ui.container module
This file contains the implementation of the class Container: a scene-graph node holding any number of child widgets, dispatching input to them (mouse hit-testing, keyboard focus/navigation) and rendering/updating them in add order.
Author: Alejandro Mujica (aledrums@gmail.com)
- class gale.ui.container.Container(x, y, width, height, children=None, theme=None, visible=True)[source]
Bases:
WidgetA real scene-graph node holding any number of child widgets. Rendered/updated in add order (which is also z-order: to bring a widget to front, remove and re-add it). Mouse events hit-test children in reverse add order (top-most first) and stop at the first one that consumes the event. on_confirm/on_navigate are forwarded only to the currently focused child; an unconsumed on_navigate instead moves focus to the next focusable sibling.
Usage example:
- menu = Container(40, 40, 240, 160, children=[
Panel(40, 40, 240, 160), ListView(48, 48, 224, 144, items=[(“Host”, start_hosting), (“Join”, start_joining)]),
])
- Parameters:
- property focusable: bool
bool(x) -> bool
Returns True when the argument x is true, False otherwise. The builtins True and False are the only two instances of the class bool. The class bool is a subclass of the class int, and cannot be subclassed.
- on_mouse_click(position, data)[source]
- Parameters:
position (Tuple[float, float])
data (MouseClickData)
- Return type:
bool
- Parameters:
direction (Tuple[int, int])
- Return type:
bool