diff --git a/.gitignore b/.gitignore index 6609df1..51044e5 100644 --- a/.gitignore +++ b/.gitignore @@ -94,3 +94,4 @@ ENV/ # VScode .vscode/ +*.pyc diff --git a/User_Interface.py b/User_Interface.py index 79426a2..d95d3f1 100644 --- a/User_Interface.py +++ b/User_Interface.py @@ -1,11 +1,41 @@ from tkinter import * -class EmptyFrame: +class HelmholtzGUI(Tk): - def __init__(self, window): - frame = Frame(window, width=1000, height=600) - frame.pack() + def __init__(self): + Tk.__init__(self) + + self.Menu = TopMenu(self) # displays menu bar at the top + + mainArea = Frame(self) + mainArea.pack(fill="both", expand=True) + + # mainArea.grid_rowconfigure(0, weight=1) + # mainArea.grid_columnconfigure(0, weight=1) + + self.frames = {} # dictionary for storing all pages + + frame = EmptyFrame(mainArea) + + self.frames[EmptyFrame] = frame + + # frame.grid(row=0, column=0, sticky="nsew") + + self.show_frame(EmptyFrame) + + def show_frame(self, key): + frame = self.frames[key] # gets correct page from the dictionary + frame.tkraise() # brings this frame to the front + + +class EmptyFrame(Frame): + + def __init__(self, parent): + Frame.__init__(self, parent) + + frame = Frame(parent, width=1000, height=600) + frame.pack(padx=50, pady=50) one = Label(frame, text="One", bg="red") one.pack(fill=X) @@ -21,8 +51,7 @@ class TopMenu: ModeSelector = Menu(menu) menu.add_cascade(label="Mode", menu=ModeSelector) - ModeSelector.add_command(label="Full Manual", command=self.manual_mode(window)) + ModeSelector.add_command(label="Full Manual", command=self.manual_mode) - def manual_mode(self, window): - print("Switching to manual mode") - window.delete(ALL) + def manual_mode(self): + print("Switching to manual mode") \ No newline at end of file diff --git a/__pycache__/cage_func.cpython-37.pyc b/__pycache__/cage_func.cpython-37.pyc deleted file mode 100644 index f1aaeae..0000000 Binary files a/__pycache__/cage_func.cpython-37.pyc and /dev/null differ diff --git a/__pycache__/globals.cpython-37.pyc b/__pycache__/globals.cpython-37.pyc deleted file mode 100644 index 18c683c..0000000 Binary files a/__pycache__/globals.cpython-37.pyc and /dev/null differ diff --git a/globals.py b/globals.py index 7181e66..2846827 100644 --- a/globals.py +++ b/globals.py @@ -18,5 +18,5 @@ global MAX_VOLTS global ARDUINO -RELAY_PINS = [1, 2, 3] # digital pin on the Arduino for switching relay of each axis [x,y,z] +RELAY_PINS = [15, 16, 17] # pin on the Arduino for switching relay of each axis [x,y,z] diff --git a/main.py b/main.py index 20169d0..3aea811 100644 --- a/main.py +++ b/main.py @@ -24,8 +24,7 @@ g.Z_PORT = "COM2" # Code starts here------------------------------------------ g.MAX_AMPS = np.sqrt(g.MAX_WATTS / g.RESISTANCES) # calculate maximum currents in each axis -mainWindow = Tk() -MainFrame = ui.EmptyFrame(mainWindow) +mainWindow = ui.HelmholtzGUI() Menu = ui.TopMenu(mainWindow) mainWindow.mainloop()