added start botton to the bottom left corner
This commit is contained in:
parent
eb116803d0
commit
44ef5ce6cb
1 changed files with 21 additions and 2 deletions
|
|
@ -9,6 +9,7 @@ import sys
|
||||||
from enum import Enum
|
from enum import Enum
|
||||||
import tkinter
|
import tkinter
|
||||||
from GAME_METHODS import *
|
from GAME_METHODS import *
|
||||||
|
import functools #used for passing variables into callbacks
|
||||||
|
|
||||||
##check if python 3.11 is running code and exit if not
|
##check if python 3.11 is running code and exit if not
|
||||||
|
|
||||||
|
|
@ -25,6 +26,7 @@ BEAMNG_UDP_PORT = 4444
|
||||||
FORZA_UDP_PORT= 4843
|
FORZA_UDP_PORT= 4843
|
||||||
SERIAL_PORT = ""
|
SERIAL_PORT = ""
|
||||||
firstRun= True #used to do the headers for csv files
|
firstRun= True #used to do the headers for csv files
|
||||||
|
pushingToArduino = False
|
||||||
|
|
||||||
class GameType(Enum):
|
class GameType(Enum):
|
||||||
NONE=0
|
NONE=0
|
||||||
|
|
@ -63,11 +65,22 @@ 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'
|
||||||
|
|
||||||
|
def startStopButtonFunc():
|
||||||
|
global pushingToArduino
|
||||||
|
if pushingToArduino == True:
|
||||||
|
startStopButton.config(text="start")
|
||||||
|
pushingToArduino = False
|
||||||
|
elif pushingToArduino == False:
|
||||||
|
startStopButton.config(text="stop")
|
||||||
|
pushingToArduino = True
|
||||||
|
|
||||||
##GUI init
|
##GUI init
|
||||||
rootFrameGui= tkinter.Tk()
|
rootFrameGui= tkinter.Tk()
|
||||||
rootFrameGui.title("Car speed to arduino")
|
rootFrameGui.title("Car speed to arduino")
|
||||||
rootFrameGui.geometry("400x200")
|
rootFrameGui.geometry("400x200")
|
||||||
|
|
||||||
|
bottomBarFrameGui = tkinter.ttk.Frame(rootFrameGui,padding=0,relief="groove",borderwidth=2,)
|
||||||
|
bottomBarFrameGui.pack(anchor="se",side="bottom",fill="x")
|
||||||
firstFrameGui=tkinter.ttk.Frame(rootFrameGui,padding=2,relief="groove",borderwidth=2)
|
firstFrameGui=tkinter.ttk.Frame(rootFrameGui,padding=2,relief="groove",borderwidth=2)
|
||||||
firstFrameGui.pack(anchor="ne",side="left",expand=True)
|
firstFrameGui.pack(anchor="ne",side="left",expand=True)
|
||||||
secondFrameGui=tkinter.ttk.Frame(rootFrameGui,padding=2,relief="groove",borderwidth=2)
|
secondFrameGui=tkinter.ttk.Frame(rootFrameGui,padding=2,relief="groove",borderwidth=2)
|
||||||
|
|
@ -99,10 +112,16 @@ loggingFrameGui= tkinter.ttk.Frame(firstFrameGui,padding=5,relief="groove",borde
|
||||||
loggingFrameGui.pack(anchor="nw")
|
loggingFrameGui.pack(anchor="nw")
|
||||||
tkLoggingEnabled=tkinter.BooleanVar()
|
tkLoggingEnabled=tkinter.BooleanVar()
|
||||||
tkLoggingEnabled.set(False)
|
tkLoggingEnabled.set(False)
|
||||||
tkinter.Checkbutton(loggingFrameGui,text="Enable Logging",variable=tkLoggingEnabled,onvalue=True,offvalue=False).pack(side="bottom")
|
tkinter.Checkbutton(loggingFrameGui,text="Enable Logging",variable=tkLoggingEnabled,onvalue=True,offvalue=False).pack(side="top")
|
||||||
|
loggingLocationText = tkinter.StringVar(value= "./")
|
||||||
|
loggingLocationEntry = tkinter.Entry(loggingFrameGui)
|
||||||
|
loggingLocationEntry.insert(0,loggingLocationText.get())
|
||||||
|
loggingLocationEntry.pack(side="bottom")
|
||||||
|
startStopButton= tkinter.Button(bottomBarFrameGui,text= "start",command= startStopButtonFunc)
|
||||||
|
startStopButton.pack(side="right",fill="x")
|
||||||
|
|
||||||
rootFrameGui.mainloop()
|
rootFrameGui.mainloop()
|
||||||
##exit() #### exit for testing
|
exit() #### exit for testing
|
||||||
#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")
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue