Internal class for generating unique IDs for UI elements.
Generates IDs in the format: ui_{element_type}_{counter}
Example: ui_button_1, ui_label_2, ui_dropdown_1
def __init__(self: Any) -> Any
def generate_id(self: Any, element_type: str) -> str
Enumeration of possible UI element states.
NORMAL: Any = 0
HOVERED: Any = 1
PRESSED: Any = 2
DISABLED: Any = 3
No methods defined.
Manages fonts and ensures Pygame font system is initialized.
_initialized: Any = False
_default_fonts: Any = {}
def initialize(cls: Any) -> Any
def get_font(cls: Any, font_name: Optional[str] = None, font_size: int = 24) -> Any
Base class for all UI elements providing common functionality.
Attributes:
element_id (str): Unique identifier for this element in format ui_{type}_{counter}
x (int): X coordinate position
y (int): Y coordinate position
width (int): Width of the element in pixels
height (int): Height of the element in pixels
root_point (Tuple[float, float]): Anchor point for positioning
state (UIState): Current state of the element
visible (bool): Whether element is visible
enabled (bool): Whether element is enabled
children (List[UIElement]): Child elements
parent (UIElement): Parent element
_global_engine: 'LunaEngine' = None
def __init__(self: Any, x: int, y: int, width: int, height: int, root_point: Tuple[float, float] = (0, 0), element_id: Optional[str] = None) -> Any
def get_mouse_position(self: Any, input_state: InputState) -> Tuple[int, int]
def convert_mouse_pos(self: Any, mouse_pos: Tuple[int, int]) -> Tuple[int, int]
def mouse_over(self: Any, input_state: InputState) -> bool
def set_enabled(self: Any, enabled: bool) -> Any
def get_engine(self: Any) -> 'LunaEngine'
def set_corner_radius(self: Any, radius: int | Tuple[int, int, int, int]) -> Any
def add_group(self: Any, group: str) -> Any
def remove_group(self: Any, group: str) -> Any
def clear_groups(self: Any) -> Any
def has_group(self: Any, group: str) -> bool
def __str__(self: Any) -> str
def get_id(self: Any) -> str
def set_id(self: Any, new_id: str) -> None
def get_actual_position(self: Any, x: int | float = None, y: int | float = None) -> Tuple[int, int]
def add_child(self: Any, child: Any) -> Any
def remove_child(self: Any, child: Any) -> Any
def set_tooltip(self: Any, tooltip: 'Tooltip') -> Any
def set_simple_tooltip(self: Any, text: str, **kwargs: dict) -> Any
def remove_tooltip(self: Any) -> Any
def update(self: Any, dt: float, inputState: InputState) -> Any
def update_theme(self: Any, theme_type: ThemeType) -> Any
def render(self: Any, renderer: Renderer | OpenGLRenderer) -> Any
def on_click(self: Any) -> Any
def on_hover(self: Any) -> Any
UI element for displaying text labels.
def __init__(self: Any, x: int, y: int, text: str, font_size: int = 24, color: Optional[Tuple[int, int, int]] = None, font_name: Optional[str] = None, root_point: Tuple[float, float] = (0, 0), theme: ThemeType = None, element_id: Optional[str] = None) -> Any
def get_text(self: Any) -> str
def update_theme(self: Any, theme_type: Any) -> Any
def set_text_color(self: Any, color: Tuple[int, int, int]) -> Any
def font(self: Any) -> Any
def set_text(self: Any, text: str) -> Any
def set_theme(self: Any, theme_type: ThemeType) -> Any
def _get_text_color(self: Any) -> Tuple[int, int, int]
def render(self: Any, renderer: 'Renderer') -> Any
No documentation
def __init__(self: Any, x: int, y: int, image_path: str | pygame.Surface, width: Optional[int] = None, height: Optional[int] = None, root_point: Tuple[float, float] = (0, 0), element_id: Optional[str] = None) -> Any
def _load_image(self: Any) -> Any
def set_image(self: Any, image_path: str | pygame.Surface) -> Any
def get_image(self: Any) -> pygame.Surface
def set_size(self: Any, width: int, height: int) -> Any
def render(self: Any, renderer: Any) -> Any
No documentation
def __init__(self: Any, x: int, y: int, width: int, height: int, text: str = '', font_size: int = 20, font_name: Optional[str] = None, root_point: Tuple[float, float] = (0, 0), theme: ThemeType = None, element_id: Optional[str] = None) -> Any
def set_background_color(self: Any, color: Tuple[int, int, int]) -> Any
def set_text_color(self: Any, color: Tuple[int, int, int]) -> Any
def set_text(self: Any, text: str) -> Any
def get_text(self: Any) -> str
def update_theme(self: Any, theme_type: Any) -> Any
def font(self: Any) -> Any
def set_on_click(self: Any, callback: Callable, *args: tuple, **kwargs: dict) -> Any
def set_theme(self: Any, theme_type: ThemeType) -> Any
def _get_colors(self: Any) -> Any
def update(self: Any, dt: float, inputState: InputState) -> Any
def _get_color_for_state(self: Any) -> Tuple[int, int, int]
def _get_text_color(self: Any) -> Tuple[int, int, int]
def render(self: Any, renderer: 'Renderer') -> Any
No documentation
def __init__(self: Any, x: int, y: int, image_path: str | pygame.Surface, width: Optional[int] = None, height: Optional[int] = None, root_point: Tuple[float, float] = (0, 0), theme: ThemeType = None, element_id: Optional[str] = None) -> Any
def _load_image(self: Any) -> Any
def set_on_click(self: Any, callback: Callable, *args: tuple, **kwargs: dict) -> Any
def get_image(self: Any) -> Any
def set_image(self: Any, image_path: str | pygame.Surface) -> Any
def update(self: Any, dt: float, inputState: InputState) -> Any
def _get_overlay_color(self: Any) -> Optional[Tuple[int, int, int]]
def render(self: Any, renderer: Any) -> Any
No documentation
def __init__(self: Any, x: int, y: int, width: int, height: int, text: str = '', font_size: int = 20, font_name: Optional[str] = None, root_point: Tuple[float, float] = (0, 0), theme: ThemeType = None, max_length: int = 0, element_id: Optional[str] = None) -> Any
def font(self: Any) -> Any
def get_text(self: Any) -> str
def has_focus(self: Any) -> bool
def on_key_down(self: Any, event: pygame.event.Event) -> Any
def on_key_up(self: Any, event: pygame.event.Event) -> Any
def _update_text_surface(self: Any) -> Any
def _get_text_color(self: Any) -> Any
def _get_background_color(self: Any) -> Any
def set_text(self: Any, text: str) -> Any
def update(self: Any, dt: Any, inputState: Any) -> Any
def focus(self: Any) -> Any
def unfocus(self: Any) -> Any
def _get_cursor_position(self: Any, actual_x: int, actual_y: int) -> Tuple[int, int]
def render(self: Any, renderer: Any) -> Any
def _render_text_content(self: Any, renderer: Any, actual_x: int, actual_y: int, theme: Any) -> Any
RPG-style dialog box with multiple display styles and text animations.
Supports typewriter effect, fade-in, and character-by-character display.
def __init__(self: Any, x: int, y: int, width: int, height: int, style: Literal['default', 'rpg', 'pokemon', 'modern'] = 'default', theme: ThemeType = None, element_id: Optional[str] = None) -> Any
def set_text(self: Any, text: str, speaker_name: str = '', instant: bool = False) -> Any
def set_animation(self: Any, animation_type: str, speed: int = 30) -> Any
def skip_animation(self: Any) -> Any
def advance(self: Any) -> Any
def set_on_complete(self: Any, callback: Callable) -> Any
def set_on_advance(self: Any, callback: Callable) -> Any
def update(self: Any, dt: float, inputState: InputState) -> Any
def render(self: Any, renderer: Any) -> Any
def _render_wrapped_text(self: Any, renderer: Any, x: int, y: int, width: int, height: int, theme: Any) -> Any
No documentation
def __init__(self: Any, x: int, y: int, width: int, height: int, min_val: float = 0, max_val: float = 100, value: float = 0, root_point: Tuple[float, float] = (0, 0), theme: ThemeType = None, orientation: Literal['vertical', 'horizontal'] = 'horizontal', element_id: Optional[str] = None) -> Any
def set_background_color(self: Any, color: Any) -> Any
def set_foreground_color(self: Any, color: Any) -> Any
def set_font_color(self: Any, color: Any) -> Any
def set_font(self: Any, font_name: str, font_size: int) -> Any
def set_border_color(self: Any, color: Any) -> Any
def update_theme(self: Any, theme_type: Any) -> Any
def set_value(self: Any, value: float) -> Any
def get_percentage(self: Any) -> float
def render(self: Any, renderer: Any) -> Any
No documentation
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) -> Any
def update(self: Any, dt: float, inputState: InputState) -> Any
def render(self: Any, renderer: Any) -> Any
No documentation
def __init__(self: Any, x: int, y: int, width: int, height: int, colors: List[Tuple[int, int, int]], direction: str = 'horizontal', root_point: Tuple[float, float] = (0, 0), element_id: Optional[str] = None) -> Any
def _generate_gradient(self: Any) -> Any
def _interpolate_colors_linear(self: Any, ratio: float) -> Tuple[int, int, int]
def _interpolate_colors(self: Any, ratio: float) -> Tuple[int, int, int]
def set_colors(self: Any, colors: List[Tuple[int, int, int]]) -> Any
def render(self: Any, renderer: Any) -> Any
No documentation
def __init__(self: Any, x: int, y: int, width: int, height: int, options: List[str], font_size: int = 20, font_name: Optional[str] = None, root_point: Tuple[float, float] = (0, 0), theme: ThemeType = None, element_id: Optional[str] = None) -> Any
def _create_arrow_surfaces(self: Any) -> Any
def font(self: Any) -> Any
def next_option(self: Any) -> Any
def previous_option(self: Any) -> Any
def set_selected_index(self: Any, index: int) -> Any
def set_on_selection_changed(self: Any, callback: Callable[[int, str], None]) -> Any
def update(self: Any, dt: Any, inputState: Any) -> Any
def render(self: Any, renderer: Any) -> Any
def _render_select_content(self: Any, renderer: Any, actual_x: int, actual_y: int, theme: Any) -> Any
def _draw_fallback_arrows(self: Any, renderer: Any, actual_x: int, actual_y: int, arrow_color: Any) -> Any
No documentation
def __init__(self: Any, x: int, y: int, width: int = 60, height: int = 30, checked: bool = False, root_point: Tuple[float, float] = (0, 0), theme: ThemeType = None, element_id: Optional[str] = None) -> Any
def toggle(self: Any) -> Any
def set_checked(self: Any, checked: bool) -> Any
def set_on_toggle(self: Any, callback: Callable[[bool], None]) -> Any
def update(self: Any, dt: Any, inputState: Any) -> Any
def _get_colors(self: Any) -> Any
def render(self: Any, renderer: Any) -> Any
No documentation
def __init__(self: Any, x: int, y: int, width: int, height: int, min_val: float = 0, max_val: float = 100, value: float = 50, root_point: Tuple[float, float] = (0, 0), theme: ThemeType = None, element_id: Optional[str] = None) -> Any
def set_theme(self: Any, theme_type: ThemeType) -> Any
def _get_colors(self: Any) -> Any
def set_value(self: Any, value: float) -> Any
def update(self: Any, dt: Any, inputState: Any) -> Any
def render(self: Any, renderer: Any) -> Any
No documentation
def __init__(self: Any, x: int, y: int, width: int, height: int, options: List[str] = None, font_size: int = 20, font_name: Optional[str] = None, root_point: Tuple[float, float] = (0, 0), theme: ThemeType = None, max_visible_options: int = 10, element_id: Optional[str] = None, searchable: bool = False) -> Any
def _create_search_box(self: Any) -> Any
def _on_search_text_changed(self: Any, text: str) -> Any
def _update_filtered_options(self: Any) -> Any
def font(self: Any) -> Any
def set_options(self: Any, options: List[str], selected_index: int = 0) -> Any
def set_theme(self: Any, theme_type: ThemeType) -> Any
def _get_colors(self: Any) -> Any
def _get_visible_options(self: Any) -> List[int]
def on_scroll(self: Any, event: pygame.event.Event) -> Any
def _get_scrollbar_track_rect(self: Any, actual_x: int, actual_y: int) -> Tuple[int, int, int, int]
def _get_scrollbar_thumb_rect(self: Any, actual_x: int, actual_y: int) -> Tuple[int, int, int, int]
def update(self: Any, dt: float, inputState: InputState) -> Any
def render(self: Any, renderer: Renderer) -> Any
def _draw_arrow_polygon(self: Any, renderer: Any, points: Any, color: Any) -> Any
def _render_expanded_options(self: Any, renderer: Any, actual_x: Any, actual_y: Any, theme: Any) -> Any
def add_option(self: Any, option: str) -> Any
def remove_option(self: Any, option: str) -> Any
def set_selected_index(self: Any, index: int) -> Any
def set_on_selection_changed(self: Any, callback: Callable[[int, str], None]) -> Any
No documentation
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) -> Any
def add_child(self: Any, child: UIElement) -> Any
def set_background_color(self: Any, color: Optional[Tuple[int, int, int]]) -> Any
def set_border_color(self: Any, color: Optional[Tuple[int, int, int]]) -> Any
def set_border(self: Any, color: Optional[Tuple[int, int, int]], width: int = 1) -> Any
def set_padding(self: Any, padding: int) -> Any
def set_corner_radius(self: Any, radius: int | Tuple[int, int, int, int]) -> Any
def get_content_rect(self: Any) -> Tuple[int, int, int, int]
def update_theme(self: Any, theme_type: ThemeType) -> Any
def update(self: Any, dt: Any, inputState: Any) -> Any
def render(self: Any, renderer: Any) -> Any
def arrange_children_vertically(self: Any, spacing: int = 5, align: str = 'left') -> Any
def arrange_children_horizontally(self: Any, spacing: int = 5, align: str = 'top') -> Any
def clear_children(self: Any) -> Any
UI element that allows a user to select a number within a specified range
using increment and decrement controls.
This element manages its value internally, ensuring it stays within
the defined min_value and max_value. It also handles formatting with
a minimum number of digits (min_length) using padding.
Attributes:
min_value (int): The lowest allowed value.
max_value (int): The highest allowed value.
min_length (int): Minimum number of digits for display padding (e.g., 5 -> '05').
max_length (int): Maximum number of digits allowed.
Internal Attributes:
_value (int): The current selected value.
_font (pygame.font.Font): Cached font object used for rendering the number.
_up_rect (pygame.Rect): Rectangular area for the increment button (relative position).
_down_rect (pygame.Rect): Rectangular area for the decrement button (relative position).
_is_up_pressed (bool): True if the increment button is currently pressed.
_is_down_pressed (bool): True if the decrement button is currently pressed.
_last_mouse_pos_rel (Tuple[int, int]): Last mouse position relative to the element (for state update).
def __init__(self: Any, x: int, y: int, width: int, height: int, min_value: int, max_value: int, value: int, min_length: int = 1, max_length: int = 10, step: int = 1, root_point: Tuple[float, float] = (0, 0), theme: ThemeType = None, element_id: Optional[str] = None) -> Any
def value(self: Any) -> int
def get_value(self: Any) -> int
def value(self: Any, new_value: int) -> Any
def _format_value(self: Any) -> str
def increment(self: Any) -> Any
def decrement(self: Any) -> Any
def _setup_control_areas(self: Any) -> Any
def _get_button_colors(self: Any, theme: Any) -> Any
def update(self: Any, dt: Any, inputState: Any) -> Any
def render(self: Any, renderer: Any) -> Any
A binary state control element that allows a user to select a boolean value (checked or unchecked).
The Checkbox is typically rendered as a small square box that can be toggled by clicking.
Attributes:
checked (bool): The current state of the checkbox (True if checked, False otherwise).
label (Optional[str]): The text label to display next to the checkbox.
label_position (str): Position of the label relative to the box ('right' or 'left').
box_size (int): The size (width and height) of the square checkbox box.
Internal Attributes:
_font (pygame.font.Font): Cached font object for rendering the label.
on_toggle: Callable[[bool], None] = None
def __init__(self: Any, x: int, y: int, width: int, height: int, checked: bool, label: Optional[str] = None, label_position: str = 'right', root_point: Tuple[float, float] = (0, 0), theme: ThemeType = None, element_id: Optional[str] = None) -> Any
def set_on_toggle(self: Any, callback: Callable[[bool], None]) -> Any
def get_state(self: Any) -> bool
def value(self: Any) -> bool
def _get_colors(self: Any) -> Tuple[Tuple[int, int, int], Tuple[int, int, int], Tuple[int, int, int], Tuple[int, int, int]]
def toggle(self: Any) -> Any
def update(self: Any, dt: Any, inputState: Any) -> Any
def render(self: Any, renderer: Any) -> Any
A frame container with scrollable content.
Supports both horizontal and vertical scrolling with scrollbars.
Automatically handles clipping of child elements to visible area.
Attributes:
content_width (int): Total width of scrollable content area.
content_height (int): Total height of scrollable content area.
scroll_x (int): Current horizontal scroll position.
scroll_y (int): Current vertical scroll position.
scrollbar_size (int): Width/height of scrollbars.
dragging_vertical (bool): Whether vertical scrollbar is being dragged.
dragging_horizontal (bool): Whether horizontal scrollbar is being dragged.
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) -> Any
def set_background_color(self: Any, color: Tuple[int, int, int]) -> Any
def update_theme(self: Any, theme_type: Any) -> Any
def clear_children(self: Any) -> Any
def get_mouse_position(self: Any, input_state: Any) -> Tuple[int, int]
def mouse_over(self: Any, input_state: InputState) -> bool
def update(self: Any, dt: Any, inputState: Any) -> Any
def on_scroll(self: Any, event: pygame.event.Event) -> Any
def render(self: Any, renderer: Any) -> Any
def _get_vertical_scrollbar_rect(self: Any, x: int, y: int) -> Tuple[int, int, int, int]
def _get_horizontal_scrollbar_rect(self: Any, x: int, y: int) -> Tuple[int, int, int, int]
def _draw_horizontal_scrollbar(self: Any, renderer: Any, x: int, y: int, theme: Any) -> Any
def _draw_vertical_scrollbar(self: Any, renderer: Any, x: int, y: int, theme: Any) -> Any
A tabbed interface element that organizes content into multiple tabs.
Displays clickable tabs at the top with their content below.
Supports alternating background colors for tabs and theme-based styling.
Attributes:
tabs (List[Dict]): List of tab information dictionaries.
current_tab (int): Index of currently active tab.
tab_height (int): Height of the tab headers.
font_size (int): Font size for tab titles.
font_name (str): Font name for tab titles.
tab_padding (int): Padding inside tabs.
def __init__(self: Any, x: int, y: int, width: int, height: int, font_size: int = 20, font_name: Optional[str] = None, root_point: Tuple[float, float] = (0, 0), theme: ThemeType = None, element_id: Optional[str] = None) -> Any
def _calculate_tab_colors(self: Any) -> Any
def font(self: Any) -> Any
def update_theme(self: Any, theme_type: ThemeType) -> Any
def add_tab(self: Any, tab_name: str) -> bool
def add_to_tab(self: Any, tab_name: str, ui_element: UIElement) -> bool
def switch_tab(self: Any, tab_index: int) -> bool
def get_tab_index(self: Any, tab_name: str) -> int
def remove_tab(self: Any, tab_name: str) -> bool
def get_tab(self: Any, tab_name: str) -> Optional[Dict[str, Any]]
def get_tab_frame(self: Any, tab_name: str) -> Optional[UiFrame]
def _get_tab_colors(self: Any, tab_index: int, is_active: bool, is_hovered: bool) -> Tuple[Tuple[int, int, int], Tuple[int, int, int]]
def _get_tab_rect(self: Any, tab_index: int, actual_x: int, actual_y: int) -> Tuple[int, int, int, int]
def update(self: Any, dt: Any, inputState: Any) -> Any
def render(self: Any, renderer: OpenGLRenderer) -> Any
A clock UI element that can display both analog and digital time.
Supports both 12-hour and 24-hour formats, real-time or custom time,
and various customization options.
Attributes:
diameter (int): Diameter of the analog clock face.
use_real_time (bool): Whether to use the system's real time.
show_numbers (bool): Whether to show numbers on the analog clock.
time_style (str): '12hr' or '24hr' format.
mode (str): 'analog', 'digital', or 'both'.
custom_time (datetime): Custom time to display (if not using real time).
def __init__(self: Any, x: int, y: int, diameter: int = 100, font_name: Optional[str] = None, font_size: int = 16, use_real_time: bool = True, show_numbers: bool = True, time_style: Literal['12hr', '24hr'] = '24hr', mode: Literal['analog', 'digital', 'both'] = 'analog', root_point: Tuple[float, float] = (0, 0), theme: ThemeType = None, element_id: Optional[str] = None) -> Any
def font(self: Any) -> Any
def small_font(self: Any) -> Any
def update_theme(self: Any, theme_type: ThemeType) -> Any
def set_face_color(self: Any, color: Tuple[int, int, int]) -> Any
def set_border_color(self: Any, color: Tuple[int, int, int]) -> Any
def set_hand_colors(self: Any, hour: Tuple[int, int, int], minute: Tuple[int, int, int], second: Tuple[int, int, int]) -> Any
def set_number_color(self: Any, color: Tuple[int, int, int]) -> Any
def set_digital_text_color(self: Any, color: Tuple[int, int, int]) -> Any
def set_time(self: Any, time_struct: time.struct_time) -> Any
def set_time_from_string(self: Any, time_str: str, format_str: str = '%H:%M:%S') -> Any
def get_time_string(self: Any) -> str
def update(self: Any, dt: float, inputState: InputState) -> Any
def render(self: Any, renderer: Renderer) -> Any
def _render_analog_clock(self: Any, renderer: Renderer, x: int, y: int) -> Any
def _draw_clock_numbers(self: Any, renderer: Renderer, center_x: int, center_y: int, radius: int) -> Any
def _draw_tick_marks(self: Any, renderer: Renderer, center_x: int, center_y: int, radius: int) -> Any
def _draw_hand(self: Any, renderer: Renderer, center_x: int, center_y: int, angle: float, length: float, width: int, color: Tuple[int, int, int]) -> Any
def _render_digital_clock(self: Any, renderer: Renderer, x: int, y: int) -> Any
Real-time audio visualization element that displays audio data in various styles.
Supports multiple visualization modes and can connect to OpenAL audio sources.
Attributes:
style (str): Visualization style ('bars', 'waveform', 'circle', 'particles', 'spectrum')
source: OpenAL audio source to visualize
color_gradient (List[Tuple[int, int, int]]): Colors for gradient visualization
bar_width (int): Width of bars in bar mode
bar_spacing (int): Spacing between bars
sensitivity (float): Audio sensitivity/amplification
smoothing (float): Smoothing factor for transitions
def __init__(self: Any, x: int, y: int, width: int, height: int, style: Literal['bars', 'waveform', 'circle', 'particles', 'spectrum'] = 'bars', source: Any = None, color_gradient: Optional[List[Tuple[int, int, int]]] = None, root_point: Tuple[float, float] = (0, 0), theme: ThemeType = None, element_id: Optional[str] = None) -> Any
def _initialize_audio_data(self: Any) -> Any
def _generate_gradient_surface(self: Any) -> Any
def _interpolate_gradient(self: Any, ratio: float) -> Tuple[int, int, int]
def set_style(self: Any, style: str) -> Any
def set_source(self: Any, source: Any) -> Any
def set_color_gradient(self: Any, gradient: List[Tuple[int, int, int]]) -> Any
def set_sensitivity(self: Any, sensitivity: float) -> Any
def set_smoothing(self: Any, smoothing: float) -> Any
def _get_audio_data(self: Any) -> List[float]
def _process_audio_data(self: Any, raw_data: List[float]) -> Any
def update(self: Any, dt: float, inputState: InputState) -> Any
def render(self: Any, renderer: Renderer) -> Any
def _render_bars(self: Any, renderer: Renderer, x: int, y: int) -> Any
def _render_waveform(self: Any, renderer: Renderer, x: int, y: int) -> Any
def _render_circle(self: Any, renderer: Renderer, x: int, y: int) -> Any
def _render_particles(self: Any, renderer: Renderer, x: int, y: int) -> Any
def _render_spectrum(self: Any, renderer: Renderer, x: int, y: int) -> Any
def _get_bar_color(self: Any, value: float) -> Tuple[int, int, int]
def _get_waveform_color(self: Any, position: float) -> Tuple[int, int, int]
def _get_circle_color(self: Any, position: float) -> Tuple[int, int, int]
def _get_particle_color(self: Any, value: float, index: int) -> Tuple[int, int, int]
def _get_spectrum_color(self: Any, frequency: float) -> Tuple[int, int, int]
Pagination control for navigating through multiple pages of content.
Displays page numbers and navigation buttons to switch between pages.
Supports custom button styles and ellipsis for large page ranges.
Attributes:
total_pages (int): Total number of pages.
current_page (int): Currently selected page (1-indexed).
max_visible_pages (int): Maximum number of page buttons to show.
show_prev_next (bool): Whether to show previous/next buttons.
show_first_last (bool): Whether to show first/last page buttons.
button_style (str): Style for page buttons ('numbers', 'dots', 'compact').
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
def set_page(self: Any, page: int) -> Any
def set_total_pages(self: Any, total_pages: int) -> Any
def set_current_page(self: Any, page: int) -> Any
def next_page(self: Any) -> Any
def previous_page(self: Any) -> Any
def first_page(self: Any) -> Any
def last_page(self: Any) -> Any
def set_on_page_change(self: Any, callback: Callable[[int, int], None]) -> Any
def _trigger_page_change(self: Any, old_page: int) -> Any
def _calculate_visible_pages(self: Any) -> List[int]
def _create_buttons(self: Any) -> Any
def _update_button_states(self: Any) -> Any
def update(self: Any, dt: float, inputState: InputState) -> Any
def render(self: Any, renderer: Renderer) -> Any
Multi-line text input area with word wrapping and scrollbars.
Supports text editing, selection, copy/paste, and line numbers.
Attributes:
text (str): The text content.
line_numbers (bool): Whether to show line numbers.
word_wrap (bool): Whether to wrap long lines.
read_only (bool): Whether text is read-only.
tab_size (int): Number of spaces for tab character.
def __init__(self: Any, x: int, y: int, width: int, height: int, text: str = '', font_size: int = 16, font_name: Optional[str] = None, line_numbers: bool = True, word_wrap: bool = True, read_only: bool = False, tab_size: int = 4, root_point: Tuple[float, float] = (0, 0), theme: ThemeType = None, element_id: Optional[str] = None) -> Any
def font(self: Any) -> Any
def get_text(self: Any) -> str
def set_text(self: Any, text: str) -> Any
def _update_dimensions(self: Any) -> Any
def _update_text_buffer(self: Any) -> Any
def _save_to_undo_stack(self: Any) -> Any
def undo(self: Any) -> Any
def redo(self: Any) -> Any
def _get_visible_lines(self: Any) -> List[int]
def _get_cursor_screen_pos(self: Any) -> Tuple[int, int]
def _scroll_to_cursor(self: Any) -> Any
def _insert_text(self: Any, text: str) -> Any
def _delete_selection(self: Any) -> Any
def _get_selection_text(self: Any) -> str
def copy(self: Any) -> Any
def cut(self: Any) -> Any
def paste(self: Any) -> Any
def select_all(self: Any) -> Any
def _move_cursor(self: Any, line_delta: int, column_delta: int, extend_selection: bool = False) -> Any
def update(self: Any, dt: float, inputState: InputState) -> Any
def on_key_down(self: Any, event: pygame.event.Event) -> Any
def on_key_up(self: Any, event: pygame.event.Event) -> Any
def _get_cursor_from_mouse(self: Any, mouse_pos: Tuple[int, int]) -> Tuple[int, int]
def handle_key_event(self: Any, event: Any) -> Any
def render(self: Any, renderer: Renderer) -> Any
def _draw_selection_highlight(self: Any, renderer: Renderer, actual_x: int, actual_y: int, line_num: int, line_y: int) -> Any
def _calculate_text_width(self: Any, text: str) -> int
File selection element with text field and browse button.
Displays selected file path and allows browsing filesystem via dialog.
Supports file filtering and custom icons.
Attributes:
file_path (str): Currently selected file path.
file_filter (List[str]): List of file extensions to filter.
dialog_title (str): Title for file dialog.
button_text (str): Text for browse button.
show_icon (bool): Whether to show file icon.
def __init__(self: Any, x: int, y: int, width: int, height: int, file_path: str = '', file_filter: Optional[List[str]] = None, dialog_title: str = 'Select File', button_text: str = 'Browse...', show_icon: bool = True, icon_path: Optional[str] = None, root_point: Tuple[float, float] = (0, 0), theme: ThemeType = None, element_id: Optional[str] = None) -> Any
def _check_tkinter(self: Any) -> bool
def _create_child_elements(self: Any) -> Any
def _get_default_icon(self: Any) -> pygame.Surface
def set_file_path(self: Any, path: str) -> Any
def _update_icon(self: Any) -> Any
def _open_file_dialog(self: Any) -> Any
def _open_tkinter_dialog(self: Any) -> Any
def _open_simple_dialog(self: Any) -> Any
def _get_initial_directory(self: Any) -> Optional[str]
def set_on_file_selected(self: Any, callback: Callable[[str], None]) -> Any
def get_file_path(self: Any) -> str
def update(self: Any, dt: float, inputState: InputState) -> Any
def render(self: Any, renderer: Renderer) -> Any
A versatile data visualization component that can display various chart types:
bar charts (vertical/horizontal), pie charts, line charts, and scatter plots.
Supports animated transitions when data changes, automatic normalization,
legends, titles, and customizable colors. Designed to work with any renderer
that provides basic drawing primitives.
def __init__(self: Any, x: int, y: int, width: int, height: int, data: Optional[List[float]] = None, labels: Optional[List[str]] = None, colors: Optional[List[Tuple[int, int, int]]] = None, chart_type: Literal['bar', 'pie', 'line', 'scatter'] = 'bar', orientation: Literal['vertical', 'horizontal'] = 'vertical', title: str = '', show_labels: bool = True, show_legend: bool = False, min_value: Optional[float] = None, max_value: Optional[float] = None, root_point: Tuple[float, float] = (0, 0), theme: ThemeType = None, element_id: Optional[str] = None) -> Any
def _default_colors(self: Any) -> List[Tuple[int, int, int]]
def title_font(self: Any) -> Any
def label_font(self: Any) -> Any
def legend_font(self: Any) -> Any
def set_data(self: Any, data: List[float], labels: Optional[List[str]] = None, animate: bool = False, duration: float = 0.5) -> Any
def update(self: Any, dt: float, inputState: InputState) -> Any
def _recalc(self: Any) -> Any
def _get_color(self: Any, index: int) -> Tuple[int, int, int]
def render(self: Any, renderer: Renderer) -> Any
def _render_bar(self: Any, renderer: Any, left: Any, top: Any, width: Any, height: Any, theme: Any) -> Any
def _render_pie(self: Any, renderer: Any, left: Any, top: Any, width: Any, height: Any, theme: Any) -> Any
def _render_line(self: Any, renderer: Any, left: Any, top: Any, width: Any, height: Any, theme: Any) -> Any
def _render_scatter(self: Any, renderer: Any, left: Any, top: Any, width: Any, height: Any, theme: Any) -> Any
def _render_legend(self: Any, renderer: Any, x: Any, y: Any, theme: Any) -> Any