simvx.core.ui.core

Core UI types — Control, Theme, Colour, UIInputEvent, FocusMode, AnchorPreset, SizeFlags, DragData.

Module Contents

Classes

Control

Base class for all UI elements.

Data

API

simvx.core.ui.core.log[source]

‘getLogger(…)’

simvx.core.ui.core.__all__

[‘Control’, ‘Theme’, ‘ThemeColour’, ‘ThemeSize’, ‘ThemeStyleBox’, ‘Colour’, ‘UIInputEvent’, ‘FocusMo…

class simvx.core.ui.core.Control(**kwargs)[source]

Bases: simvx.core.nodes_2d.node2d.Node2D

Base class for all UI elements.

Supports anchors, margins, sizing, focus, drag-and-drop, and input handling. Widgets draw themselves using the renderer passed to draw().

Example: control = Control(name=”panel”) control.size = Vec2(200, 100) control.set_anchor_preset(AnchorPreset.FULL_RECT)

Initialization

size_x

‘Property(…)’

size_y

‘Property(…)’

property size: simvx.core.math.types.Vec2

Size backed by size_x/size_y Properties (inspector-synced).

touch_mode: str

‘mouse’

property theme: simvx.core.ui.types.Theme | None
property mouse_over: bool
property focused: bool
property disabled: bool
get_theme() simvx.core.ui.types.Theme[source]

Get effective theme (own -> parent -> default).

queue_redraw()[source]

Mark this control as needing a redraw. Propagates upward to parent.

get_minimum_size() simvx.core.math.types.Vec2[source]

Minimum size needed to display content. Subclasses override.

get_rect() tuple[float, float, float, float][source]

Get (x, y, width, height) in parent space.

get_global_rect() tuple[float, float, float, float][source]

Get (x, y, width, height) in screen space.

Uses axis-aligned position accumulation (no rotation/scale) since UI controls are always axis-aligned rectangles. Result is cached per-frame and auto-expires when the frame counter advances.

is_point_inside(point) bool[source]

Check if point (screen coords) is inside this control.

set_anchor_preset(preset: simvx.core.ui.enums.AnchorPreset)[source]

Set anchors from a preset.

Example: panel.set_anchor_preset(AnchorPreset.FULL_RECT) # fills parent label.set_anchor_preset(AnchorPreset.CENTER) # centered

set_focus()[source]

Request focus for this control.

grab_focus()[source]

Claim keyboard focus for this control.

Unfocuses the currently focused control (if any) and sets focus to this one. Respects focus_mode: NONE-mode controls cannot receive focus.

release_focus()[source]

Release focus from this control.

has_focus() bool[source]

Return True if this control currently has keyboard focus.

focus_next_control()[source]

Move focus to next control in tab order.

focus_previous_control()[source]

Move focus to previous control in tab order.

grab_mouse()[source]

Capture mouse – all mouse events route to this control until released.

release_mouse()[source]

Release mouse capture.

set_drag_preview(control: simvx.core.ui.core.Control)[source]

Set a visual preview control for the current drag operation.

draw_popup(renderer)[source]

Draw popup overlay content. Override in popup-capable widgets.

is_popup_point_inside(point) bool[source]

Check if point is inside the popup area. Override in subclasses.

popup_input(event)[source]

Handle input on the popup overlay. Override in subclasses.

dismiss_popup()[source]

Close the popup. Override in subclasses.

z_index

‘Property(…)’

z_as_relative

‘Property(…)’

render_layer

‘Property(…)’

set_render_layer(index: int, enabled: bool = True) None
is_on_render_layer(index: int) bool
property absolute_z_index: int
property position: simvx.core.math.types.Vec2
property rotation: float
property rotation_degrees: float
property scale: simvx.core.math.types.Vec2
property world_position: simvx.core.math.types.Vec2
property world_rotation: float
property world_scale: simvx.core.math.types.Vec2
property forward: simvx.core.math.types.Vec2
property right: simvx.core.math.types.Vec2
translate(offset: tuple[float, float] | numpy.ndarray)
rotate(radians: float)
rotate_deg(degrees: float)
look_at(target: tuple[float, float] | numpy.ndarray)
transform_points(points: list[simvx.core.math.types.Vec2]) list[simvx.core.math.types.Vec2]
draw_polygon(renderer, points: list[simvx.core.math.types.Vec2], closed=True, colour=None)
wrap_screen(margin: float = 20)
strict_errors: ClassVar[bool]

True

script_error_raised

‘Signal(…)’

classmethod __init_subclass__(**kwargs)
property name: str
property process_mode: simvx.core.descriptors.ProcessMode
reset_error() None
add_child(node: simvx.core.node.Node) simvx.core.node.Node
remove_child(node: simvx.core.node.Node)
reparent(new_parent: simvx.core.node.Node)
get_node(path: str) simvx.core.node.Node
find_child(name: str, recursive: bool = False) simvx.core.node.Node | None
find(node_type: type, recursive: bool = True) simvx.core.node.Node | None
find_all(node_type: type, recursive: bool = True) list
property path: str
add_to_group(group: str)
remove_from_group(group: str)
is_in_group(group: str) bool
ready() None
enter_tree() None
exit_tree() None
process(dt: float) None
physics_process(dt: float) None
draw(renderer) None
input_event(event: simvx.core.events.InputEvent) None
input(event: simvx.core.events.TreeInputEvent) None
unhandled_input(event: simvx.core.events.TreeInputEvent) None
start_coroutine(gen: simvx.core.descriptors.Coroutine) simvx.core.descriptors.CoroutineHandle
stop_coroutine(gen_or_handle)
clear_children()
destroy()
property app
property tree: simvx.core.scene_tree.SceneTree
get_tree() simvx.core.scene_tree.SceneTree
__getitem__(key: str)
classmethod get_properties() dict[str, simvx.core.descriptors.Property]
__repr__()