added serial selection screen

This commit is contained in:
Seth Samuel 2024-11-14 22:34:55 +13:00
parent c6cd1c0b99
commit 3f6aedffbc

View file

@ -15,16 +15,6 @@ from GAME_METHODS import *
if not(sys.version_info[0] == 3 and sys.version_info[1] == 11): if not(sys.version_info[0] == 3 and sys.version_info[1] == 11):
raise Exception("code must be run in python verion 3.11.\ninput struct for network needs to be changed per python version.") raise Exception("code must be run in python verion 3.11.\ninput struct for network needs to be changed per python version.")
##GUI init
rootFrameGui= tkinter.Tk()
rootFrameGui.title("Car speed to arduino")
rootFrameGui.geometry("400x200")
# theme: https://github.com/rdbende/Azure-ttk-theme
rootFrameGui.tk.call("source","azure.tcl") ##import theme
rootFrameGui.tk.call("set_theme","dark") ##set theme to dark
firstFrameGui=tkinter.ttk.Frame(rootFrameGui,padding=10)
##system init ##system init
@ -73,6 +63,30 @@ else:
print("OS detection failed setting serial port to 'COM5'\n") print("OS detection failed setting serial port to 'COM5'\n")
SERIAL_PORT = 'COM5' SERIAL_PORT = 'COM5'
##GUI init
rootFrameGui= tkinter.Tk()
rootFrameGui.title("Car speed to arduino")
rootFrameGui.geometry("400x200")
# theme: https://github.com/rdbende/Azure-ttk-theme
rootFrameGui.tk.call("source","azure.tcl") ##import theme
rootFrameGui.tk.call("set_theme","dark") ##set theme to dark
firstFrameGui=tkinter.ttk.Frame(rootFrameGui,padding=10)
firstFrameGui.pack()
serialFrameGui = tkinter.ttk.Frame(firstFrameGui,padding=10)
serialFrameGui.pack(side="left")
serialLableText =tkinter.StringVar()
serialLableText.set("Serial Port")
serialLable = tkinter.Label(serialFrameGui,textvariable=serialLableText)
serialLable.pack(side="top")
serialEntry=tkinter.Entry(serialFrameGui)
serialEntry.insert(0,SERIAL_PORT)
serialEntry.pack(side="left")
gameSelectFrame= tkinter.ttk.Frame(firstFrameGui,padding=10)
gameSelectFrame.pack(side="right")
#select game #select game
while gameSelected == False: while gameSelected == False:
gameNo = input("1:BEAMNG\n2:FORZA\n\n7:Toggle CSV out ("+str(csvOut)+")\n9:SET SERIAL PORT ("+SERIAL_PORT+")\n") gameNo = input("1:BEAMNG\n2:FORZA\n\n7:Toggle CSV out ("+str(csvOut)+")\n9:SET SERIAL PORT ("+SERIAL_PORT+")\n")