demo-04-20/menu.py

34 lines
1012 B
Python
Raw Permalink Normal View History

2020-04-28 10:51:27 +02:00
from draw import *
2020-04-27 19:00:34 +02:00
2020-05-03 18:32:24 +02:00
choices = ("imagination", "usb_key", "tron", "exit")
2020-04-27 19:00:34 +02:00
selection = 0
cursor = 0
try:
while 1:
try:
clear_screen()
fancy_text(0, 0, choices[selection].upper().replace("_", " "))
2020-04-27 19:00:34 +02:00
while 1:
show_screen()
cursor += 1
if cursor == 64:
cursor = 0
selection += 1
if selection == len(choices):
selection = 0
2020-05-08 10:32:02 +02:00
clear_screen()
fancy_text(0, 0, choices[selection].upper().replace("_", " "))
2020-04-27 19:00:34 +02:00
except KeyboardInterrupt:
2020-05-03 18:23:28 +02:00
assert choices[selection] != "exit"
2020-04-27 19:00:34 +02:00
draw_string(0, 16, "Loading...")
show_screen()
try:
play = __import__(choices[selection])
play.main()
2020-04-27 19:00:34 +02:00
except KeyboardInterrupt:
pass
clear_screen()
except AssertionError:
print("Thanks for 'playing'!")