1234567891011121314151617181920212223242526272829303132 |
- import tkinter as tk
- import tk_tools
- import numpy as np
- from datetime import datetime
- from .Plot import Plot
- from .globals import *
- class Page_2(tk.Frame):
- plotLen = 100
- 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.forcePlot = Plot(xaxis=(-2, 2), yaxis=(-2, 2),
- ytitle="y-Kraft [mV]",
- xtitle="x-Kraft [mV]",
- title="XY-Graph",
- line_colors=["#2222ff", "#22ff22", "#ff2222", "#000000"])
- canvas = self.forcePlot.create_canvas(self)
- canvas.pack(side=tk.LEFT, fill=tk.BOTH, expand=True)
- def update(self, visible):
- if visible:
- self.forcePlot.plot_data(
- xs=[self.controller.getLastValues(self.plotLen, "force_X_{}".format(i+1)) for i in range(3)] +
- [np.sin(np.linspace(0, 6.282, self.plotLen))],
- ys=[self.controller.getLastValues(self.plotLen, "force_Y_{}".format(i+1)) for i in range(3)] +
- [np.cos(np.linspace(0, 6.282, self.plotLen))]
- )
|