textinputs.py

No documentation

class TextBox

Description

No documentation

Methods
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
No documentation
def font(self: Any) -> Any
No documentation
def get_text(self: Any) -> str
No documentation
def has_focus(self: Any) -> bool
No documentation
def on_key_down(self: Any, event: pygame.event.Event) -> Any
No documentation
def on_key_up(self: Any, event: pygame.event.Event) -> Any
No documentation
def _update_text_surface(self: Any) -> Any
No documentation
def _get_text_color(self: Any) -> Any
No documentation
def _get_background_color(self: Any) -> Any
No documentation
def set_text(self: Any, text: str) -> Any
No documentation
def update(self: Any, dt: Any, inputState: Any) -> Any
No documentation
def focus(self: Any) -> Any
No documentation
def unfocus(self: Any) -> Any
No documentation
def _get_cursor_position(self: Any, actual_x: int, actual_y: int) -> Tuple[int, int]
No documentation
def render(self: Any, renderer: Any) -> Any
No documentation
def _render_text_content(self: Any, renderer: Any, actual_x: int, actual_y: int, theme: Any) -> Any
No documentation

class TextArea

Description

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.

Methods
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
No documentation
def font(self: Any) -> Any
No documentation
def get_text(self: Any) -> str
No documentation
def set_text(self: Any, text: str) -> Any
No documentation
def _update_dimensions(self: Any) -> Any
No documentation
def _update_text_buffer(self: Any) -> Any
No documentation
def _save_to_undo_stack(self: Any) -> Any
No documentation
def undo(self: Any) -> Any
No documentation
def redo(self: Any) -> Any
No documentation
def _get_visible_lines(self: Any) -> List[int]
No documentation
def _get_cursor_screen_pos(self: Any) -> Tuple[int, int]
No documentation
def _scroll_to_cursor(self: Any) -> Any
No documentation
def _insert_text(self: Any, text: str) -> Any
No documentation
def _delete_selection(self: Any) -> Any
No documentation
def _get_selection_text(self: Any) -> str
No documentation
def copy(self: Any) -> Any
No documentation
def cut(self: Any) -> Any
No documentation
def paste(self: Any) -> Any
No documentation
def select_all(self: Any) -> Any
No documentation
def _move_cursor(self: Any, line_delta: int, column_delta: int, extend_selection: bool = False) -> Any
No documentation
def update(self: Any, dt: float, inputState: InputState) -> Any
No documentation
def on_key_down(self: Any, event: pygame.event.Event) -> Any
No documentation
def on_key_up(self: Any, event: pygame.event.Event) -> Any
No documentation
def _get_cursor_from_mouse(self: Any, mouse_pos: Tuple[int, int]) -> Tuple[int, int]
No documentation
def handle_key_event(self: Any, event: Any) -> Any
No documentation
def render(self: Any, renderer: Renderer) -> Any
No documentation
def _draw_selection_highlight(self: Any, renderer: Renderer, actual_x: int, actual_y: int, line_num: int, line_y: int) -> Any
No documentation
def _calculate_text_width(self: Any, text: str) -> int
No documentation
Back to Ui Module