diff --git a/README.md b/README.md index 8f2d1e1..c5dee12 100644 --- a/README.md +++ b/README.md @@ -21,142 +21,79 @@ It is now production-ready (tested on 2x16 displays only at the moment.) ToDo: M ## Gallery -Here are some of examples of how a lcdMenu will look, and to get those, simply append the `Code` column's contents to the following (considering you have the library "installed" as explained before. All the examples below use a 2x16 display. - -```python -from lcdMenu import lcdMenu -from machine import Pin, I2C -from PCF8574T import I2C_LCD - -prev_btn = Pin(13, Pin.IN, Pin.PULL_DOWN) # input of the first btn -next_btn = Pin(14, Pin.IN, Pin.PULL_DOWN) # input of the second btn -ok_btn = Pin(15, Pin.IN, Pin.PULL_DOWN) # input of switch - -LCD = I2C_LCD(I2C(0, sda=Pin(8), scl=Pin(9), freq=400000),0x27,2, 16) - -def first(): - print("first() called! 1") -def second(): - print("second() called! 2") -def third(): - print("third() called! 3") - return True - - -menuItems = [("first item", first), - ("second item", second), - ("third item", third)] -button_mappings = {"prev_btn":prev_btn, "next_btn": next_btn, "ok_btn": ok_btn} -``` +Here are some of examples of how a lcdMenu will look, showcasing the amount of options you have with lcdMenu. Currently, as the library is only tested with 2x16 displays, these are the only ones showing up below - but on 4x20, it should look the same except it's bigger!
Scroll direction | Cycling | Title shown | -Scroll direction | Initial selection | Result | -Code | |
---|---|---|---|---|---|---|---|
yes | -no | -vertical | -first | -![]() |
- -menu = lcdMenu(LCD, button_mappings, scroll_direction=False, cycle=True, hide_menu_name=True) -menu.setup(menuItems) -menu.run() |
- ||
no | -no | -vertical | -first | -![]() |
- -menu = lcdMenu(LCD, button_mappings, scroll_direction=False, cycle=False, hide_menu_name=True) # <- change of cycle to False! -menu.setup(menuItems) -menu.run() |
- ||
no | -no | -vertical | -middle | -![]() |
- -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() |
- ||
no | -no | -vertical | -last | -![]() |
- -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() |
- ||
no | -yes | -vertical | -no options (first and last) | -![]() |
- -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() |
- ||
no | -yes | -vertical | -first | -![]() |
- -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() |
- ||
no | -yes | -vertical | -middle | -![]() |
- -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() |
- ||
no | -yes | -vertical | -last | -![]() |
- -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() |
- ||
yes | -yes | horizontal | +yes | +yes | first | ![]() |
- -menu = lcdMenu(LCD, button_mappings, scroll_direction=True, cycle=True, hide_menu_name=False, name="lcdMenu!") -menu.setup(menuItems) -menu.run() |
+
vertical | +yes | +no | +first | +![]() |
+ |||
vertical | +no | +no | +first | +![]() |
+ |||
vertical | +no | +no | +middle | +![]() |
+ |||
vertical | +no | +no | +last | +![]() |
+ |||
vertical | +no | +yes | +no options (first and last) | +![]() |
+ |||
vertical | +no | +yes | +first | +![]() |
+ |||
vertical | +no | +yes | +middle | +![]() |
+ |||
vertical | +no | +yes | +last | +![]() |