12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485 |
- # The code for changing pages was derived from: http://stackoverflow.com/questions/7546050/switch-between-two-frames-in-tkinter
- # License: http://creativecommons.org/licenses/by-sa/3.0/
- from analogPressure.sdpArray import SdpArray
- from digitalPressure.sdp610Array import Spd610Array
- from wirelessLoadCell.loadCells import LoadCells
- from ui import *
- import tkinter as tk
- import tk_tools
- from time import *
- class Main(tk.Tk):
- def __init__(self, *args, **kwargs):
- tk.Tk.__init__(self, *args, **kwargs)
- tk.Tk.wm_title(self, "Windkanal-Tool")
-
-
- container = tk.Frame(self)
- container.pack(side="top", fill="both", expand = True)
- container.grid_rowconfigure(0, weight=1)
- container.grid_columnconfigure(0, weight=1)
- menubar = tk.Menu(container)
- filemenu = tk.Menu(menubar, tearoff=0)
- filemenu.add_command(label="Save settings", command = lambda: self.popupmsg("Not supported just yet!"))
- filemenu.add_separator()
- filemenu.add_command(label="Exit", command=quit)
- menubar.add_cascade(label="File", menu=filemenu)
- tk.Tk.config(self, menu=menubar)
- label = tk.Label(self, text="Bedienelemente", font=LARGE_FONT)
- label.pack(pady=10,padx=10)
- # top menu
- top = tk.Frame(self, borderwidth=2, relief="solid")
- button1 = tk.Button(top, text="Bedienelemente", command=lambda: self.show_frame(Page_1))
- button1.pack(side=tk.LEFT)
- button2 = tk.Button(top, text="Kräfte", command=lambda: self.show_frame(Page_2))
- button2.pack(side=tk.LEFT)
- button3 = tk.Button(top, text="Druck", command=lambda: self.show_frame(Page_3))
- button3.pack(side=tk.LEFT)
- button4 = tk.Button(top,text="Einstellungen",command=lambda: self.show_frame(Page_4))
- button4.pack(side=tk.LEFT)
- button5 = tk.Button(top, text="QUIT", fg="red",command=quit)
- button5.pack(side=tk.LEFT)
- top.pack(side="top", expand=True, fill="both")
- self.frames = {}
- for F in (Page_1, Page_2, Page_3, Page_4):
- frame = F(container, self)
- self.frames[F] = frame
- frame.grid(row=0, column=0, sticky="nsew")
- self.show_frame(Page_1)
- def show_frame(self, cont):
- frame = self.frames[cont]
- frame.tkraise()
- def popupmsg(self, msg=""):
- popup = tk.Toplevel(self.master)
- popup.wm_title("Error!")
- label = tk.Label(popup, text=msg, font=LARGE_FONT)
- label.pack(side="top", fill="x", pady=10)
- b1 = tk.Button(popup, text="Okay", command=popup.destroy)
- b1.pack()
- def interval(self):
-
- for frame in self.frames:
- frame.update()
- self.after(300,self.interval)
-
|