mirror of
https://github.com/alee14-projects/RPi-Menu.git
synced 2025-01-22 09:02:03 -05:00
Renaming root to app, moved variables, changed README
This commit is contained in:
parent
84724e813f
commit
1a82700f23
3 changed files with 59 additions and 31 deletions
20
README.md
20
README.md
|
@ -1,2 +1,22 @@
|
|||
# RPI Menu
|
||||
Basically a full screen program menu. Meant for Raspberry Pi OS.
|
||||
|
||||
I recommend you putting this repo on your home folder under the name `menu`. (/home/pi)
|
||||
|
||||
# Requirements
|
||||
- Python 3+
|
||||
- Tkinter 8+
|
||||
- Kodi
|
||||
- Steam Link
|
||||
- [Retropie](https://retropie.org.uk/docs/Manual-Installation/)
|
||||
- [Mycroft AI](https://mycroft-ai.gitbook.io/docs/using-mycroft-ai/get-mycroft/linux) (Optional) (Must clone it on the home folder)
|
||||
|
||||
# Putting this on startup
|
||||
If you want to make this python app autostart when xserver is started do the following
|
||||
|
||||
Edit `/etc/xdg/lxsession/LXDE-pi/autostart`
|
||||
|
||||
Add the following command in the bottom `/usr/bin/python3 /home/pi/menu/menu.py`
|
||||
|
||||
# Debugging
|
||||
If you're using SSH (recommended). You need to execute `run.sh`.
|
3
launchES.sh
Executable file
3
launchES.sh
Executable file
|
@ -0,0 +1,3 @@
|
|||
#!/bin/bash
|
||||
sudo pkill Xorg &
|
||||
emulationstation
|
65
menu.py
65
menu.py
|
@ -1,6 +1,6 @@
|
|||
#!/usr/bin/env python3
|
||||
"""
|
||||
RPi Menu
|
||||
Raspberry Pi OS Menu: Where do you want to go today?
|
||||
Copyright (C) 2020 Andrew Lee
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
|
@ -20,23 +20,7 @@ import tkinter
|
|||
import os
|
||||
from tkinter import *
|
||||
from tkinter import font as tkFont
|
||||
root = tkinter.Tk()
|
||||
root.attributes('-fullscreen', True)
|
||||
root.title("Startup GUI")
|
||||
root['background']='#4d4d4d'
|
||||
print("RPi Menu Copyright (C) 2020 Andrew Lee\nThis program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.\nThis is free software, and you are welcome to redistribute it\nunder certain conditions; type `show c' for details.\n")
|
||||
print("Starting Startup GUI")
|
||||
print("Tkinter Version:" , tkinter.TkVersion)
|
||||
|
||||
# Variables
|
||||
btnSizeW = 60
|
||||
btnSizeH = 3
|
||||
btnBG = "#8c8c8c"
|
||||
btnABG = "#666666"
|
||||
btnBD = 0
|
||||
btnRelief = "flat"
|
||||
labelFont = tkFont.Font(size=15, weight="bold")
|
||||
btnFont = tkFont.Font(size=12, weight="bold")
|
||||
app = tkinter.Tk()
|
||||
|
||||
# Functions
|
||||
def launchDesktop():
|
||||
|
@ -49,34 +33,55 @@ def launchDashboard():
|
|||
quit()
|
||||
def launchRetroPie():
|
||||
print("Launching RetroPie")
|
||||
os.system("sudo su -c \"systemctl stop lightdm ; ttyecho -n /dev/tty1 \"emulationstation ; sudo systemctl start lightdm\"\"")
|
||||
# os.system("nohup sudo su -c \"systemctl stop lightdm ; ttyecho -n /dev/tty1 \"emulationstation ; sudo systemctl start lightdm\"\"")
|
||||
#os.system("nohup sudo pkill Xorg ; emulationstation")
|
||||
os.system("bash /home/pi/menu/launchES.sh")
|
||||
quit()
|
||||
def launchSteam():
|
||||
print("Launching Steam Link")
|
||||
os.system("steamlink &")
|
||||
os.system("/usr/bin/steamlink &")
|
||||
quit()
|
||||
def launchKodi():
|
||||
print("Launching Kodi")
|
||||
os.system("kodi &")
|
||||
os.system("/usr/bin/kodi &")
|
||||
quit()
|
||||
|
||||
# Variables
|
||||
appName = "Raspberry Pi OS Menu"
|
||||
appBackground = "#4d4d4d"
|
||||
btnSizeW = 60
|
||||
btnSizeH = 3
|
||||
btnBG = "#8c8c8c"
|
||||
btnABG = "#666666"
|
||||
btnBD = 0
|
||||
btnRelief = "flat"
|
||||
labelFont = tkFont.Font(size=15, weight="bold")
|
||||
btnFont = tkFont.Font(size=12, weight="bold")
|
||||
|
||||
print(appName + " Copyright (C) 2020 Andrew Lee\nThis program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.\nThis is free software, and you are welcome to redistribute it\nunder certain conditions; type `show c' for details.\n")
|
||||
print("Starting " + appName)
|
||||
print("Tkinter Version:" , tkinter.TkVersion)
|
||||
app.attributes('-fullscreen', True)
|
||||
app.title(appName)
|
||||
app.configure(bg=appBackground)
|
||||
|
||||
# Labels
|
||||
varWelcome = StringVar()
|
||||
labelWelcome = Label( root, textvariable=varWelcome, font=labelFont, bg="#4d4d4d", fg="white")
|
||||
labelWelcome = Label( app, textvariable=varWelcome, font=labelFont, bg=appBackground, fg="white")
|
||||
varWelcome.set("Welcome to Raspberry Pi OS!\nWhere do you want to go today?\n")
|
||||
|
||||
varCopyright = StringVar()
|
||||
labelCopyright = Label( root, textvariable=varCopyright, font=labelFont, bg="#4d4d4d", fg="white")
|
||||
labelCopyright = Label( app, textvariable=varCopyright, font=labelFont, bg=appBackground, fg="white")
|
||||
varCopyright.set("(C) Copyright 2020, Andrew Lee. Licensed with GPL-3.0\nhttps://alee14.me")
|
||||
|
||||
# Buttons
|
||||
btnDesktop = Button(root, text = 'Desktop', width=btnSizeW, height=btnSizeH, font=btnFont, bg=btnBG, activebackground=btnABG, bd=btnBD, relief=btnRelief, command = launchDesktop)
|
||||
btnDashboard = Button(root, text = 'Dashboard + Mycroft AI', width=btnSizeW, height=btnSizeH, font=btnFont, bg=btnBG, activebackground=btnABG, bd=btnBD, relief=btnRelief, command = launchDashboard)
|
||||
btnRetroPie = Button(root, text = 'RetroPie', width=btnSizeW, height=btnSizeH, font=btnFont, bg=btnBG, activebackground=btnABG, bd=btnBD, relief=btnRelief, command = launchRetroPie)
|
||||
btnSteamLink = Button(root, text = 'Steam Link', width=btnSizeW, height=btnSizeH, font=btnFont, bg=btnBG, activebackground=btnABG, bd=btnBD, relief=btnRelief, command = launchSteam)
|
||||
btnKodi = Button(root, text = 'Kodi', width=btnSizeW, height=btnSizeH, font=btnFont, bg=btnBG, activebackground=btnABG, relief=btnRelief, bd=btnBD, command = launchKodi)
|
||||
btnDesktop = Button(app, text = 'Desktop', width=btnSizeW, height=btnSizeH, font=btnFont, bg=btnBG, activebackground=btnABG, bd=btnBD, relief=btnRelief, command = launchDesktop)
|
||||
btnDashboard = Button(app, text = 'Dashboard + Mycroft AI', width=btnSizeW, height=btnSizeH, font=btnFont, bg=btnBG, activebackground=btnABG, bd=btnBD, relief=btnRelief, command = launchDashboard)
|
||||
btnRetroPie = Button(app, text = 'RetroPie', width=btnSizeW, height=btnSizeH, font=btnFont, bg=btnBG, activebackground=btnABG, bd=btnBD, relief=btnRelief, command = launchRetroPie)
|
||||
btnSteamLink = Button(app, text = 'Steam Link', width=btnSizeW, height=btnSizeH, font=btnFont, bg=btnBG, activebackground=btnABG, bd=btnBD, relief=btnRelief, command = launchSteam)
|
||||
btnKodi = Button(app, text = 'Kodi', width=btnSizeW, height=btnSizeH, font=btnFont, bg=btnBG, activebackground=btnABG, relief=btnRelief, bd=btnBD, command = launchKodi)
|
||||
|
||||
# Add the stuff
|
||||
# Add the components
|
||||
labelWelcome.pack()
|
||||
btnDesktop.pack()
|
||||
btnDashboard.pack()
|
||||
|
@ -86,4 +91,4 @@ btnKodi.pack()
|
|||
labelCopyright.pack()
|
||||
|
||||
# Run the app
|
||||
root.mainloop()
|
||||
app.mainloop()
|
||||
|
|
Loading…
Reference in a new issue