README changes to Menu section.

pull/8/head
Peter Hinch 2021-07-13 16:49:12 +01:00
rodzic b7df9c99fe
commit a9b0e90968
2 zmienionych plików z 8 dodań i 5 usunięć

Wyświetl plik

@ -2107,6 +2107,8 @@ value changes. This enables dynamic color change.
# 22 Menu class
The `Menu` class is under development. API may change.
```python
from gui.widgets.menu import Menu
```
@ -2122,10 +2124,10 @@ Constructor mandatory positional arg:
Keyword only args:
* `height=25` Height of top level menu buttons.
* `bgcolor=None`
* `fgcolor=None`
* `textcolor=None`
* `select_color=DARKBLUE`
* `bgcolor=None` Background color of buttons and dropdown.
* `fgcolor=None` Foreground color.
* `textcolor=None` Text color.
* `select_color=DARKBLUE` Background color of selected item on dropdown list.
* `args` This should be a tuple containing a tuple of args for each entry in
the top level menu. Each tuple should be of one of two forms:
1. `(text, cb, (args,))` A single-level entry: the top level `Button` with
@ -2145,6 +2147,7 @@ uses the passed arg to determine which menu it was called from.
mnu = (('Gas', cb_sm, (0,), ('Helium','Neon','Argon','Krypton','Xenon','Radon')),
('Metal', cb_sm, (1,), ('Lithium', 'Sodium', 'Potassium','Rubidium','Caesium')),
('View', cb, (2,)))
Menu(wri, bgcolor=BLUE, textcolor=WHITE, args = mnu)
```
###### [Contents](./README.md#0-contents)

Wyświetl plik

@ -51,4 +51,4 @@ sel = Pin(16, Pin.IN, Pin.PULL_UP) # Operate current control
prev = Pin(18, Pin.IN, Pin.PULL_UP) # Move to previous control
increase = Pin(20, Pin.IN, Pin.PULL_UP) # Increase control's value
decrease = Pin(17, Pin.IN, Pin.PULL_UP) # Decrease control's value
display = Display(ssd, nxt, sel, prev, increase, decrease) #, 5)
display = Display(ssd, nxt, sel, prev, increase, decrease) #, 5)