demo-04-20/menu.py

32 lines
873 B
Python

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