class documentation

A simple toggle switch for the GUI.

Method __del__ Clean up resources and deinitialize LVGL.
Method __init__ Initialize the Toggle switch with drawing context and styling.
Method clear Clear the toggle area with the background color.
Method draw Render the toggle switch on the display.
Method state.setter Set the toggle state and redraw.
Method text.setter Set the toggle text and redraw.
Method toggle Toggle the current state.
Method update Update both text and state of the toggle.
Instance Variable background_color Undocumented
Instance Variable border_color Undocumented
Instance Variable border_width Undocumented
Instance Variable display Undocumented
Instance Variable foreground_color Undocumented
Instance Variable is_circular Undocumented
Instance Variable on_color Undocumented
Instance Variable position Undocumented
Instance Variable size Undocumented
Instance Variable use_lvgl Undocumented
Property state Get the current state of the toggle.
Property text Get the current text of the toggle.
Instance Variable _lvgl_toggle Undocumented
Instance Variable _state Undocumented
Instance Variable _text Undocumented
def __del__(self):

Clean up resources and deinitialize LVGL.

def __init__(self, draw, position: Vector, size: Vector, text: str, initial_state: bool = False, foreground_color: int = 65535, background_color: int = 0, on_color: int = 31, border_color: int = 65535, border_width: int = 1, should_clear: bool = True, use_lvgl: bool = True):

Initialize the Toggle switch with drawing context and styling.

Parameters
draw:DrawThe drawing context to render the toggle.
position:VectorVector position of the toggle.
size:VectorVector size of the toggle.
text:strThe label text for the toggle.
initial_state:boolInitial state of the toggle. Defaults to False.
foreground_color:intThe color of the text. Defaults to 0xFFFF.
background_color:intThe background color. Defaults to 0x0000.
on_color:intThe color when the toggle is on. Defaults to 0x001F.
border_color:intThe color of the border. Defaults to 0xFFFF.
border_width:intThe width of the border. Defaults to 1.
should_clear:boolWhether to clear on init. Defaults to True.
use_lvgl:boolWhether to use LVGL rendering. Defaults to True.
def clear(self):

Clear the toggle area with the background color.

def draw(self, swap: bool = True, clear: bool = True, selected: bool = False):

Render the toggle switch on the display.

Parameters
swap:boolWhether to swap the display buffer. Defaults to True.
clear:boolWhether to clear the area first. Defaults to True.
selected:boolWhether the toggle is selected. Defaults to False.
def state(self, new_state: bool):

Set the toggle state and redraw.

Parameters
new_state:boolThe new toggle state.
def text(self, new_text: str):

Set the toggle text and redraw.

Parameters
new_text:strThe new toggle text.
def toggle(self):

Toggle the current state.

def update(self, text: str, state: bool):

Update both text and state of the toggle.

Parameters
text:strThe new toggle text.
state:boolThe new toggle state.
background_color =

Undocumented

border_color =

Undocumented

border_width =

Undocumented

display =

Undocumented

foreground_color =

Undocumented

is_circular =

Undocumented

on_color =

Undocumented

position =

Undocumented

size =

Undocumented

use_lvgl =

Undocumented

@property
state: bool =

Get the current state of the toggle.

@property
text: str =

Get the current text of the toggle.

_lvgl_toggle =

Undocumented

_state =

Undocumented

_text =

Undocumented