1234567891011121314151617181920212223242526272829303132 |
- import tkinter as tk
- import tk_tools
- from .globals import *
- from .Plot import Plot
- from matplotlib.backends.backend_tkagg import (
- FigureCanvasTkAgg, NavigationToolbar2Tk)
- from matplotlib.figure import Figure
- from matplotlib import style
- class Page_2(tk.Frame):
- def __init__(self, parent, controller):
- tk.Frame.__init__(self, parent)
- self.controller = controller
- label = tk.Label(self, text="Kräfte", font=LARGE_FONT)
- label.pack(pady=10,padx=10)
-
- # graphs
- self.forcePlots = [Plot(20, 3), Plot(20, 3), Plot(20, 3)]
- for plot in self.forcePlots:
- canvas = FigureCanvasTkAgg(plot.fig, self)
- canvas.draw()
- canvas.get_tk_widget().pack(side=tk.LEFT, fill=tk.BOTH, expand=True)
- canvas._tkcanvas.pack(side=tk.LEFT, fill=tk.BOTH, expand=True)
- def update(self):
- for i in range(3):
- self.forcePlots[i].update([
- self.controller.getLastValue("force_X_{}".format(i+1)),
- self.controller.getLastValue("force_Y_{}".format(i+1)),
- self.controller.getLastValue("force_Z_{}".format(i+1)),
- ])
|