Page_1.py 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. import tkinter as tk
  2. import tk_tools
  3. class Page_1(tk.Frame):
  4. def __init__(self, parent, controller):
  5. tk.Frame.__init__(self, parent)
  6. self.t = 0
  7. label = tk.Label(self, text="Bedienelemente", font=LARGE_FONT)
  8. label.pack(pady=10,padx=10)
  9. # top menu
  10. top = tk.Frame(self, borderwidth=2, relief="solid")
  11. button1 = tk.Button(top, text="Bedienelemente", command=lambda: controller.show_frame(Page_0))
  12. button1.pack(side=tk.LEFT)
  13. button2 = tk.Button(top, text="Kräfte", command=lambda: controller.show_frame(Page_2))
  14. button2.pack(side=tk.LEFT)
  15. button3 = tk.Button(top, text="Druck", command=lambda: controller.show_frame(Page_2))
  16. button3.pack(side=tk.LEFT)
  17. button4 = tk.Button(top,text="Einstellungen",command=lambda: controller.show_frame(Page_2))
  18. button4.pack(side=tk.LEFT)
  19. button5 = tk.Button(top, text="QUIT", fg="red",command=quit)
  20. button5.pack(side=tk.LEFT)
  21. top.pack(side="top", expand=True, fill="both")
  22. # graph
  23. self.serialPlot = Plot()
  24. canvas = FigureCanvasTkAgg(self.serialPlot.fig, self)
  25. canvas.draw()
  26. canvas.get_tk_widget().pack(side=tk.LEFT, fill=tk.BOTH, expand=True)
  27. canvas._tkcanvas.pack(side=tk.LEFT, fill=tk.BOTH, expand=True)
  28. # right menu
  29. left = tk.Frame(self, borderwidth=2, relief="solid")
  30. container = tk.Frame(left, borderwidth=2, relief="solid")
  31. label1 = tk.Label(container, text="I could be a canvas, but I'm a label right now")
  32. self.label4 = tk.Label(self,font=("Arial","30"),fg="red")
  33. self.label4.pack()
  34. self.label4.config(text=str(self.t))
  35. SendButton = tk.Button(left, text='Quit', command=quit)
  36. label2 = tk.Label(left, text="I could be a button")
  37. label3 = tk.Label(left, text="So could I")
  38. left.pack(side="left", expand=True, fill="both")
  39. container.pack(expand=True, fill="both", padx=7, pady=5)
  40. SendButton.pack()
  41. label1.pack()
  42. label2.pack()
  43. label3.pack()
  44. def update(self):
  45. self.serialPlot.update(3)
  46. self.label4.config(text="{:3d} Nm".format(3))