diff --git a/README.md b/README.md index f39ce9f..8f2d1e1 100644 --- a/README.md +++ b/README.md @@ -49,21 +49,116 @@ menuItems = [("first item", first), button_mappings = {"prev_btn":prev_btn, "next_btn": next_btn, "ok_btn": ok_btn} ``` -| Result | Code | -| --------- | ------- | -| ![No title, first item & cycling on -> up & down, vertical scrolling](images/2x16-title-vertical-up-down-cycling.jpg) | ```python -menu = lcdMenu(LCD, button_mappings, scroll_direction=False, cycle=True, hide_menu_name=True, name="Fullscreen!") + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
CyclingTitle shownScroll directionInitial selectionResultCode
yesnoverticalfirstNo title, first item & cycling on -> up & down, vertical scrolling
+menu = lcdMenu(LCD, button_mappings, scroll_direction=False, cycle=True, hide_menu_name=True)
 menu.setup(menuItems)
-menu.run()
-```  |
-| ![No title, first item & no cycling -> only down, vertical scrolling](images/2x16-no-title-vertical-only-down.jpg)    |  |
-| ![No title, middle item -> up & down, vertical scrolling](images/2x16-no-title-vertical-up-down.jpg)                  |  |
-| ![No title, last item & no cycling -> only up, vertical scrolling](images/2x16-no-title-vertical-only-up.jpg)         |  |
-| ![With title, only one option, vertical scrolling](images/2x16-title-vertical-no-options.jpg)                         |  |
-| ![With title, first item & no cycling -> only down, vertical scrolling](images/2x16-title-vertical-only-down.jpg)     |  |
-| ![With title, middle item -> up & down, vertical scrolling](images/2x16-title-vertical-up-down.jpg)                   |  | 
-| ![With title, last item & no cycling -> only up, vertical scrolling](images/2x16-title-vertical-only-up.jpg)          |  |
-| ![With title, middle item -> forward and backward, horizontal scrolling](images/2x16-title-horizontal.jpg)            |  |
+menu.run()
nonoverticalfirstNo title, first item & no cycling -> only down, vertical scrolling
+menu = lcdMenu(LCD, button_mappings, scroll_direction=False, cycle=False, hide_menu_name=True)   # <- change of cycle to False!
+menu.setup(menuItems)
+menu.run()
nonoverticalmiddleNo title, middle item -> up & down, vertical scrolling
+menu = lcdMenu(LCD, button_mappings, scroll_direction=False, cycle=False, hide_menu_name=True
+menu.setup(menuItems, start_selection=1)  # <- change of the initial selection
+menu.run()
nonoverticallastNo title, last item & no cycling -> only up, vertical scrolling
+menu = lcdMenu(LCD, button_mappings, scroll_direction=False, cycle=False, hide_menu_name=True)
+menu.setup(menuItems, start_selection=2)  # <- set initial selection to the last element
+menu.run()
noyesverticalno options (first and last)With title, only one option, vertical scrolling
+menu = lcdMenu(LCD, button_mappings, scroll_direction=False, cycle=False, hide_menu_name=False, name="No options!")  # now with a title
+menu.setup([("Only option", lambda: print("Only option chosen!"))])  # now with only one option (ignoring menuItems!)
+menu.run()
noyesverticalfirstWith title, first item & no cycling -> only down, vertical scrolling
+menu = lcdMenu(LCD, button_mappings, scroll_direction=False, cycle=False, hide_menu_name=False, name="No options!")
+menu.setup(menuItems)  # now with menuItems again
+menu.run()
noyesverticalmiddleWith title, middle item -> up & down, vertical scrolling
+menu = lcdMenu(LCD, button_mappings, scroll_direction=False, cycle=False, hide_menu_name=False, name="lcdMenu!")
+menu.setup(menuItems, start_selection=1)  # now with an index again
+menu.run()
noyesverticallastWith title, last item & no cycling -> only up, vertical scrolling
+menu = lcdMenu(LCD, button_mappings, scroll_direction=False, cycle=False, hide_menu_name=False, name="lcdMenu!")
+menu.setup(menuItems, start_selection=2)  # <- set initial selection to the last element
+menu.run()
yesyeshorizontalfirstWith title, middle item -> forward and backward, horizontal scrolling
+menu = lcdMenu(LCD, button_mappings, scroll_direction=True, cycle=True, hide_menu_name=False, name="lcdMenu!")
+menu.setup(menuItems)
+menu.run()
## License