Page_2.py 811 B

12345678910111213141516171819202122232425
  1. import tkinter as tk
  2. import tk_tools
  3. from .globals import *
  4. class Page_2(tk.Frame):
  5. def __init__(self, parent, controller):
  6. tk.Frame.__init__(self, parent)
  7. label = tk.Label(self, text="Kräfte", font=LARGE_FONT)
  8. label.pack(pady=10,padx=10)
  9. # graphs
  10. self.forcePlots = [Plot(20, 3), Plot(20, 3), Plot(20, 3)]
  11. for plot in self.forcePlots:
  12. canvas = FigureCanvasTkAgg(plot.fig, self)
  13. canvas.draw()
  14. canvas.get_tk_widget().pack(side=tk.LEFT, fill=tk.BOTH, expand=True)
  15. canvas._tkcanvas.pack(side=tk.LEFT, fill=tk.BOTH, expand=True)
  16. def update(self):
  17. for i in range(3):
  18. self.forcePlots.update([
  19. controller.getLastValue(f"force_X_{i}"),
  20. controller.getLastValue(f"force_Y_{i}"),
  21. controller.getLastValue(f"force_Z_{i}"),
  22. ])