diff --git a/tests.py b/tests.py index 4deae71..e954d10 100644 --- a/tests.py +++ b/tests.py @@ -1,6 +1,7 @@ from lcdMenu import lcdMenu import config from config import LCD +from time import sleep """ # testing different icon styles @@ -18,6 +19,7 @@ LCD.putstr(chr(0)+" "+chr(1)+" "+chr(2)+" "+chr(3)+" "+chr(4)+" "+chr(5)+" <>" #LCD.putstr("< >< some tst itm >") LCD.putstr("[ ------------ ]< some tst itm >") +sleep(1) def some_print(): print("some_print() executed!") @@ -26,27 +28,27 @@ def another_callback(): def third(): print("third") return True + + menuItems = [("some_print", some_print), ("another_entry", another_callback), ("third item", third)] -lm = lcdMenu(config.LCD, - {"next_btn": config.BTN_1, "ok_btn": config.BTN_2}, +submenu = lcdMenu(config.LCD, + {"next_btn": config.BTN_2, "ok_btn": config.BTN_1}, menuItems, scroll_direction=True, cycle=True, hide_menu_name=False) -print(lm.current_selection) -lm.next_selection() -print(lm.current_selection) -lm.next_selection() -print(lm.current_selection) -lm.next_selection() -print(lm.current_selection) -print("--------") -print(lm.current_selection) -lm.previous_selection() -print(lm.current_selection) -lm.previous_selection() -print(lm.current_selection) -lm.previous_selection() -print(lm.current_selection) +mainmenu = lcdMenu(config.LCD, + {"next_btn": config.BTN_2, "ok_btn": config.BTN_1}, + [("submenu",submenu.run)], + scroll_direction=True, cycle=True, + hide_menu_name=False) + +mainmenu.next_selection() +mainmenu.previous_selection() + +print("-------\nNow running!\n-------") + +submenu.run() +#mainmenu.run() \ No newline at end of file