1234567891011121314151617181920212223242526272829303132333435363738394041424344454647 |
- import tkinter as tk
- import tk_tools
- from .Plot import Plot
- from .globals import *
- import matplotlib
- from matplotlib.backends.backend_tkagg import (
- FigureCanvasTkAgg, NavigationToolbar2Tk)
- from matplotlib.figure import Figure
- from matplotlib import style
- class Page_1(tk.Frame):
- def __init__(self, parent, controller):
- tk.Frame.__init__(self, parent)
- self.t = 0
- # graph
- self.serialPlot = Plot(20)
- canvas = FigureCanvasTkAgg(self.serialPlot.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)
- # right menu
- left = tk.Frame(self, borderwidth=2, relief="solid")
- container = tk.Frame(left, borderwidth=2, relief="solid")
- label1 = tk.Label(container, text="I could be a canvas, but I'm a label right now")
- self.label4 = tk.Label(self,font=("Arial","30"),fg="red")
- self.label4.pack()
- self.label4.config(text=str(self.t))
- SendButton = tk.Button(left, text='Quit', command=quit)
- label2 = tk.Label(left, text="I could be a button")
- label3 = tk.Label(left, text="So could I")
- left.pack(side="left", expand=True, fill="both")
- container.pack(expand=True, fill="both", padx=7, pady=5)
- SendButton.pack()
- label1.pack()
- label2.pack()
- label3.pack()
- def update(self):
- self.serialPlot.update(3)
- self.label4.config(text="{:3d} Nm".format(3))
|