demo-04-20/menu.py

34 lines
1012 B
Python

from draw import *
choices = ("imagination", "usb_key", "tron", "exit")
selection = 0
cursor = 0
try:
while 1:
try:
clear_screen()
fancy_text(0, 0, choices[selection].upper().replace("_", " "))
while 1:
show_screen()
cursor += 1
if cursor == 64:
cursor = 0
selection += 1
if selection == len(choices):
selection = 0
clear_screen()
fancy_text(0, 0, choices[selection].upper().replace("_", " "))
except KeyboardInterrupt:
assert choices[selection] != "exit"
draw_string(0, 16, "Loading...")
show_screen()
try:
play = __import__(choices[selection])
play.main()
except KeyboardInterrupt:
pass
clear_screen()
except AssertionError:
print("Thanks for 'playing'!")