class documentation

A simple menu class for a GUI.

Method __del__ Clean up resources.
Method __init__ Initialize the menu with a title and an embedded list.
Method add_item Add an item to the menu.
Method clear Clear the menu.
Method draw Draw the menu.
Method draw_title Draw the title (for standard rendering only).
Method get_item Get the item at the specified index.
Method item_exists Check if an item exists in the menu.
Method refresh Refresh the menu display.
Method remove_item Remove an item from the menu.
Method scroll_down Scroll down the menu.
Method scroll_up Scroll up the menu.
Method set_selected Set the selected item.
Method title.setter Set the menu title.
Instance Variable background_color Undocumented
Instance Variable clear_position Undocumented
Instance Variable clear_size Undocumented
Instance Variable display Undocumented
Instance Variable line_pos Undocumented
Instance Variable line_size Undocumented
Instance Variable list Undocumented
Instance Variable position Undocumented
Instance Variable size Undocumented
Instance Variable text_color Undocumented
Instance Variable title_pos Undocumented
Instance Variable use_lvgl Undocumented
Property current_item Get the current item.
Property item_count Get the number of items.
Property list_height Get the height of the list.
Property selected_index Get the selected index.
Property title Get the menu title.
Instance Variable _draw_title Undocumented
Instance Variable _draw_underline Undocumented
Instance Variable _five Undocumented
Instance Variable _height_offset Undocumented
Instance Variable _title Undocumented
def __del__(self):

Clean up resources.

def __init__(self, draw, title: str, y: int, height: int, text_color: int = 65535, background_color: int = 0, selected_color: int = 31, border_color: int = 65535, border_width: int = 2):

Initialize the menu with a title and an embedded list.

Parameters
draw:DrawThe drawing context to render the menu.
title:strThe menu title.
y:intThe top Y position of the menu.
height:intThe height of the menu.
text_color:intThe text color. Defaults to 0xFFFF.
background_color:intThe background color. Defaults to 0x0000.
selected_color:intThe selected item color. Defaults to 0x001F.
border_color:intThe border color. Defaults to 0xFFFF.
border_width:intThe border width. Defaults to 2.
def add_item(self, item: str):

Add an item to the menu.

Parameters
item:strThe item to add.
def clear(self):

Clear the menu.

def draw(self):

Draw the menu.

def draw_title(self):

Draw the title (for standard rendering only).

def get_item(self, index: int) -> str:

Get the item at the specified index.

Parameters
index:intThe index of the item.
Returns
strThe item string, or "" if not found.
def item_exists(self, item: str) -> bool:

Check if an item exists in the menu.

Parameters
item:strThe item to look for.
Returns
boolTrue if the item exists.
def refresh(self):

Refresh the menu display.

def remove_item(self, index: int):

Remove an item from the menu.

Parameters
index:intThe index of the item to remove.
def scroll_down(self):

Scroll down the menu.

def scroll_up(self):

Scroll up the menu.

def set_selected(self, index: int):

Set the selected item.

Parameters
index:intThe index of the item to select.
def title(self, value: str):

Set the menu title.

Parameters
value:strThe new title.
background_color =

Undocumented

clear_position =

Undocumented

clear_size =

Undocumented

display =

Undocumented

line_pos =

Undocumented

line_size =

Undocumented

list =

Undocumented

position =

Undocumented

size =

Undocumented

text_color =

Undocumented

title_pos =

Undocumented

use_lvgl =

Undocumented

@property
current_item: str =

Get the current item.

@property
item_count: int =

Get the number of items.

@property
list_height: int =

Get the height of the list.

@property
selected_index: int =

Get the selected index.

@property
title: str =

Get the menu title.

_draw_title =

Undocumented

_draw_underline =

Undocumented

_five =

Undocumented

_height_offset: int =

Undocumented

_title =

Undocumented