Skip to content

Instantly share code, notes, and snippets.

@omiq
Created March 26, 2018 18:30
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save omiq/f2e7065d3f9e5c5ed4524d97dc30507a to your computer and use it in GitHub Desktop.
Save omiq/f2e7065d3f9e5c5ed4524d97dc30507a to your computer and use it in GitHub Desktop.
A Raspberry Pi/Linux Start Menu
import os
import readchar
# place in your start up file:
# sudo nano ./.bashrc
def menu():
while True:
os.system('clear')
print("\t\tChoose from the following options:\n\n")
print("\t\tk: Kodi")
print("\t\tr: Retro Pi")
print("\t\tx: XWindows")
print("\n\t\tEnter to quit to terminal\n\n\n")
# Read a key
key = readchar.readkey()
if(key == 'k'):
print("Launch Kodi")
os.system("kodi")
elif(key == 'r'):
print("Launch RetroPie")
os.system("emulationstation")
elif(key == 'x'):
print("Launch X Windows")
os.system("startx")
elif(key == readchar.key.ENTER):
print("Exit to terminal")
break
else:
print("Please choose an option from above")
if __name__ == "__main__":
menu()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment