Page_2.py 929 B

123456789101112131415161718192021222324252627
  1. import tkinter as tk
  2. import tk_tools
  3. from .Plot import Plot
  4. from .globals import *
  5. class Page_2(tk.Frame):
  6. def __init__(self, parent, controller):
  7. tk.Frame.__init__(self, parent)
  8. self.controller = controller
  9. label = tk.Label(self, text="Kräfte", font=LARGE_FONT)
  10. label.pack(pady=10,padx=10)
  11. # graphs
  12. self.forcePlot = Plot(nPoints=100, xaxis=(-2, 2), yaxis=(-2, 2), nGraphs=3,
  13. ytitle="y-Kraft [mV]",
  14. xtitle="x-Kraft [mV]",
  15. title="XY-Graph",
  16. line_colors=["#2222ff", "#22ff22", "#ff2222"])
  17. canvas = self.forcePlot.create_canvas(self)
  18. canvas.pack(side=tk.LEFT, fill=tk.BOTH, expand=True)
  19. def update(self, visible):
  20. self.forcePlot.update(
  21. xs=[self.controller.getLastValue("force_X_{}".format(i+1)) for i in range(3)],
  22. ys=[self.controller.getLastValue("force_Y_{}".format(i+1)) for i in range(3)],
  23. visible=visible
  24. )