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 |
Add an item to the menu. |
| Method | clear |
Clear the menu. |
| Method | draw |
Draw the menu. |
| Method | draw |
Draw the title (for standard rendering only). |
| Method | get |
Get the item at the specified index. |
| Method | item |
Check if an item exists in the menu. |
| Method | refresh |
Refresh the menu display. |
| Method | remove |
Remove an item from the menu. |
| Method | scroll |
Scroll down the menu. |
| Method | scroll |
Scroll up the menu. |
| Method | set |
Set the selected item. |
| Method | title |
Set the menu title. |
| Instance Variable | background |
Undocumented |
| Instance Variable | clear |
Undocumented |
| Instance Variable | clear |
Undocumented |
| Instance Variable | display |
Undocumented |
| Instance Variable | line |
Undocumented |
| Instance Variable | line |
Undocumented |
| Instance Variable | list |
Undocumented |
| Instance Variable | position |
Undocumented |
| Instance Variable | size |
Undocumented |
| Instance Variable | text |
Undocumented |
| Instance Variable | title |
Undocumented |
| Instance Variable | use |
Undocumented |
| Property | current |
Get the current item. |
| Property | item |
Get the number of items. |
| Property | list |
Get the height of the list. |
| Property | selected |
Get the selected index. |
| Property | title |
Get the menu title. |
| Instance Variable | _draw |
Undocumented |
| Instance Variable | _draw |
Undocumented |
| Instance Variable | _five |
Undocumented |
| Instance Variable | _height |
Undocumented |
| Instance Variable | _title |
Undocumented |
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:Draw | The drawing context to render the menu. |
title:str | The menu title. |
y:int | The top Y position of the menu. |
height:int | The height of the menu. |
textint | The text color. Defaults to 0xFFFF. |
backgroundint | The background color. Defaults to 0x0000. |
selectedint | The selected item color. Defaults to 0x001F. |
borderint | The border color. Defaults to 0xFFFF. |
borderint | The border width. Defaults to 2. |
Get the item at the specified index.
| Parameters | |
index:int | The index of the item. |
| Returns | |
str | The item string, or "" if not found. |
Check if an item exists in the menu.
| Parameters | |
item:str | The item to look for. |
| Returns | |
bool | True if the item exists. |