class documentation

class TextBox(textbox.TextBox):

Constructor: TextBox(draw, y, height, foreground_color, ...)

View In Hierarchy

Class for a text box with scrolling functionality.

Method __del__ Clean up resources and deinitialize LVGL.
Method __init__ Initialize the text box with position, height, and styling.
Method __setattr__ Set an attribute, routing text and cursor changes to setters.
Method clear Clears the text box content and screen.
Method current_text.setter Set the current text content.
Method jump_to_bottom Moves the cursor and viewport to the end of the text and redraws.
Method jump_to_top Moves the cursor and viewport to the beginning of the text and redraws.
Method refresh Refreshes the text box display to reflect any changes in content or state.
Method scroll_down Scrolls the text box content down by one line
Method scroll_up Scrolls the text box content up by one line
Method set_current_line Set the current line index for the visible portion of the text.
Method set_text Update the text content and refresh the display.
Instance Variable use_lvgl Undocumented
Property current_text Returns the current text content of the text box.
Property text_height Returns the total height of the text content in pixels.
Instance Variable _draw Undocumented
Instance Variable _lvgl_textbox Undocumented
def __del__(self):

Clean up resources and deinitialize LVGL.

def __init__(self, draw, y: int, height: int, foreground_color: int = 65535, background_color: int = 0, show_scrollbar: bool = True, show_cursor: bool = False):

Initialize the text box with position, height, and styling.

Parameters
draw:DrawThe drawing context to render the text box.
y:intThe top Y position of the text box.
height:intThe height of the text box.
foreground_color:intThe text color. Defaults to 0xFFFF.
background_color:intThe background color. Defaults to 0x0000.
show_scrollbar:boolWhether to show the scrollbar. Defaults to True.
show_cursor:boolWhether to show the cursor. Defaults to False.
def __setattr__(self, name, value):

Set an attribute, routing text and cursor changes to setters.

Parameters
name:strThe attribute name.
valueThe attribute value.
def clear(self):

Clears the text box content and screen.

def current_text(self, value: str):

Set the current text content.

Parameters
value:strThe new text content.
def jump_to_bottom(self):

Moves the cursor and viewport to the end of the text and redraws.

def jump_to_top(self):

Moves the cursor and viewport to the beginning of the text and redraws.

def refresh(self):

Refreshes the text box display to reflect any changes in content or state.

def scroll_down(self):

Scrolls the text box content down by one line

def scroll_up(self):

Scrolls the text box content up by one line

def set_current_line(self, line: int):

Set the current line index for the visible portion of the text.

Parameters
line:intThe line index to show.
def set_text(self, text: str):

Update the text content and refresh the display.

Parameters
text:strThe new text content.
use_lvgl =

Undocumented

@property
current_text: str =

Returns the current text content of the text box.

@property
text_height: int =

Returns the total height of the text content in pixels.

_draw =

Undocumented

_lvgl_textbox =

Undocumented