containers.py

No documentation

class UiFrame

Description

A container frame that can have an optional draggable header with title and icon.

Attributes
_properties: Any = {**UIElement._properties, 'header_enabled': {'name': 'header enabled', 'key': 'header_enabled', 'type': bool, 'editable': True, 'description': 'Show header bar with title/icon'}, 'header_title': {'name': 'header title', 'key': 'header_title', 'type': str, 'editable': True, 'description': 'Text displayed in header'}, 'header_height': {'name': 'header height', 'key': 'header_height', 'type': int, 'editable': True, 'description': 'Height of header bar in pixels'}, 'draggable': {'name': 'draggable', 'key': 'draggable', 'type': bool, 'editable': True, 'description': 'Allow frame to be dragged by its header'}, 'padding': {'name': 'padding', 'key': 'padding', 'type': int, 'editable': True, 'description': 'Padding inside frame'}, 'background_color': {'name': 'background color', 'key': 'background_color', 'type': tuple, 'editable': True, 'description': 'RGB background color (None = transparent)'}, 'border_color': {'name': 'border color', 'key': 'border_color', 'type': tuple, 'editable': True, 'description': 'RGB border color (None = no border)'}, 'corner_radius': {'name': 'corner radius', 'key': 'corner_radius', 'type': (int, tuple), 'editable': True, 'description': 'Radius for rounded corners'}}
Methods
def __init__(self: Any, x: int, y: int, width: int, height: int, root_point: Tuple[float, float] = (0, 0), theme: ThemeType = None, element_id: Optional[str] = None, header_enabled: bool = False, header_title: str = '', header_icon: Optional[Union[str, pygame.Surface]] = None, header_height: int = 30, draggable: bool = False, **kwargs: dict) -> Any
No documentation
def header_font(self: Any) -> Any
No documentation
def usable_space(self: Any) -> Tuple[int, int]
No documentation
def get_header_rect(self: Any) -> pygame.Rect
No documentation
def set_background_color(self: Any, color: Optional[Tuple[int, int, int]]) -> Any
No documentation
def set_border_color(self: Any, color: Optional[Tuple[int, int, int]]) -> Any
No documentation
def set_border(self: Any, color: Optional[Tuple[int, int, int]], width: int = 1) -> Any
No documentation
def set_padding(self: Any, padding: int) -> Any
No documentation
def set_corner_radius(self: Any, radius: Union[int, Tuple[int, int, int, int]]) -> Any
No documentation
def get_content_rect(self: Any) -> Tuple[int, int, int, int]
No documentation
def update_theme(self: Any, theme_type: ThemeType) -> Any
No documentation
def update(self: Any, dt: float, inputState: InputState) -> Any
No documentation
def render(self: Any, renderer: OpenGLRenderer) -> Any
No documentation
def arrange_children_vertically(self: Any, spacing: int = 5, align: str = 'left') -> Any
No documentation
def arrange_children_horizontally(self: Any, spacing: int = 5, align: str = 'top') -> Any
No documentation
def clear_children(self: Any) -> Any
No documentation

class ScrollingFrame

Description

No documentation

Attributes
_properties: Any = {**UiFrame._properties, 'content_width': {'name': 'content width', 'key': 'content_width', 'type': int, 'editable': True, 'description': 'Total width of scrollable content'}, 'content_height': {'name': 'content height', 'key': 'content_height', 'type': int, 'editable': True, 'description': 'Total height of scrollable content'}, 'scroll_x': {'name': 'scroll x', 'key': 'scroll_x', 'type': int, 'editable': False, 'description': 'Horizontal scroll offset'}, 'scroll_y': {'name': 'scroll y', 'key': 'scroll_y', 'type': int, 'editable': False, 'description': 'Vertical scroll offset'}, 'scrollbar_size': {'name': 'scrollbar size', 'key': 'scrollbar_size', 'type': int, 'editable': True, 'description': 'Width/height of scrollbars'}}
Methods
def __init__(self: Any, x: int, y: int, width: int, height: int, content_width: int, content_height: int, root_point: Tuple[float, float] = (0, 0), theme: ThemeType = None, element_id: Optional[str] = None, header_enabled: bool = False, header_title: str = '', header_icon: Optional[Union[str, pygame.Surface]] = None, header_height: int = 30, draggable: bool = False, **kwargs: dict) -> Any
No documentation
def clear_content(self: Any, reset_scroll: bool = True) -> Any
No documentation
def set_background_color(self: Any, color: Tuple[int, int, int]) -> Any
No documentation
def get_mouse_position(self: Any, input_state: Any) -> Tuple[int, int]
No documentation
def mouse_over(self: Any, input_state: InputState) -> bool
No documentation
def update(self: Any, dt: float, inputState: InputState) -> Any
No documentation
def on_scroll(self: Any, event: pygame.event.Event) -> Any
No documentation
def render(self: Any, renderer: OpenGLRenderer) -> Any
No documentation
def _get_vertical_scrollbar_rect(self: Any, fx: int, fy: int) -> pygame.Rect
No documentation
def _get_horizontal_scrollbar_rect(self: Any, fx: int, fy: int) -> pygame.Rect
No documentation
def _draw_horizontal_scrollbar(self: Any, renderer: Any, fx: int, fy: int, theme: Any) -> Any
No documentation
def _draw_vertical_scrollbar(self: Any, renderer: Any, fx: int, fy: int, theme: Any) -> Any
No documentation

class Tabination

Description

No documentation

Attributes
_properties: Any = {**UiFrame._properties, 'orientation': {'name': 'orientation', 'key': 'orientation', 'type': str, 'editable': True, 'description': 'Tab layout: horizontal, vertical1, vertical2'}, 'tab_height': {'name': 'tab height', 'key': 'tab_height', 'type': int, 'editable': True, 'description': 'Height of each tab (vertical) or tab bar (horizontal)'}, 'tab_width': {'name': 'tab width', 'key': 'tab_width', 'type': int, 'editable': True, 'description': 'Width of each tab (horizontal) or tab bar (vertical)'}, 'current_tab': {'name': 'current tab', 'key': 'current_tab', 'type': int, 'editable': False, 'description': 'Index of active tab'}}
Methods
def __init__(self: Any, x: int, y: int, width: int, height: int, font_size: int = 20, font_name: Optional[str] = None, orientation: Literal['horizontal', 'vertical1', 'vertical2'] = 'horizontal', root_point: Tuple[float, float] = (0, 0), theme: ThemeType = None, element_id: Optional[str] = None, **kwargs: dict) -> Any
No documentation
def _calculate_tab_colors(self: Any) -> Any
No documentation
def font(self: Any) -> Any
No documentation
def update_theme(self: Any, theme_type: Any) -> Any
No documentation
def add_tab(self: Any, tab_name: str, icon: Optional[Union[str, pygame.Surface]] = None) -> bool
No documentation
def add_to_tab(self: Any, tab_name: str, ui_element: UIElement) -> bool
No documentation
def switch_tab(self: Any, tab_index: int) -> bool
No documentation
def get_tab_index(self: Any, tab_name: str) -> int
No documentation
def remove_tab(self: Any, tab_name: str) -> bool
No documentation
def _update_tab_scroll(self: Any) -> Any
No documentation
def _get_tab_width(self: Any) -> int
No documentation
def _get_tab_height_for_name(self: Any, tab_name: str) -> int
No documentation
def _get_tab_rect(self: Any, idx: int, fx: int, fy: int) -> pygame.Rect
No documentation
def _draw_arrow(self: Any, renderer: Any, x: int, y: int, direction: str, hover: bool) -> Any
No documentation
def update(self: Any, dt: float, inputState: InputState) -> Any
No documentation
def _get_visible_size(self: Any) -> int
No documentation
def _get_tab_area_rect(self: Any, fx: int, fy: int) -> pygame.Rect
No documentation
def render(self: Any, renderer: OpenGLRenderer) -> Any
No documentation

class Pagination

Description

No documentation

Methods
def __init__(self: Any, x: int, y: int, width: int, height: int, total_pages: int = 1, current_page: int = 1, max_visible_pages: int = 7, show_prev_next: bool = True, show_first_last: bool = True, button_style: Literal['numbers', 'dots', 'compact'] = 'numbers', root_point: Tuple[float, float] = (0, 0), theme: ThemeType = None, element_id: Optional[str] = None) -> Any
No documentation
def set_page(self: Any, page: int) -> Any
No documentation
def set_total_pages(self: Any, total_pages: int) -> Any
No documentation
def set_current_page(self: Any, page: int) -> Any
No documentation
def next_page(self: Any) -> Any
No documentation
def previous_page(self: Any) -> Any
No documentation
def first_page(self: Any) -> Any
No documentation
def last_page(self: Any) -> Any
No documentation
def set_on_page_change(self: Any, callback: Callable[[int, int], None]) -> Any
No documentation
def _trigger_page_change(self: Any, old_page: int) -> Any
No documentation
def _calculate_visible_pages(self: Any) -> List[int]
No documentation
def _create_buttons(self: Any) -> Any
No documentation
def _update_button_states(self: Any) -> Any
No documentation
def update(self: Any, dt: float, inputState: InputState) -> Any
No documentation
def render(self: Any, renderer: Renderer) -> Any
No documentation

class Expandable

Description

No documentation

Attributes
_properties: Any = {**UiFrame._properties, 'title': {'name': 'title', 'key': 'title', 'type': str, 'editable': True, 'description': 'Header text'}, 'expanded': {'name': 'expanded', 'key': '_expanded', 'type': bool, 'editable': True, 'description': 'Whether the panel is expanded'}, 'header_height': {'name': 'header height', 'key': 'header_height', 'type': int, 'editable': False, 'description': 'Height of header button'}, 'allow_multiple': {'name': 'allow multiple', 'key': 'allow_multiple', 'type': bool, 'editable': True, 'description': 'Allow multiple expanded items in same parent'}, 'accordion_group': {'name': 'accordion group', 'key': 'accordion_group', 'type': str, 'editable': True, 'description': 'Group name for accordion behavior'}}
Methods
def __init__(self: Any, x: int, y: int, width: int, height: int, title: str = 'Expand', expanded: bool = False, allow_multiple: bool = False, accordion_group: str = None, root_point: Any = (0, 0), theme: Any = None, element_id: Any = None) -> Any
No documentation
def setupIcons(self: Any) -> Any
No documentation
def _toggle(self: Any) -> Any
No documentation
def expand(self: Any) -> Any
No documentation
def collapse(self: Any) -> Any
No documentation
def is_expanded(self: Any) -> bool
No documentation
def add_to_content(self: Any, element: UIElement) -> Any
No documentation
def update(self: Any, dt: Any, inputState: Any) -> Any
No documentation
def render(self: Any, renderer: Any) -> Any
No documentation
Back to Ui Module