import tkinter as tk
import tk_tools

class Page_1(tk.Frame):
  def __init__(self, parent, controller):
    tk.Frame.__init__(self, parent)
    self.t = 0
    label = tk.Label(self, text="Bedienelemente", font=LARGE_FONT)
    label.pack(pady=10,padx=10)
    # top menu
    top = tk.Frame(self, borderwidth=2, relief="solid")
    button1 = tk.Button(top, text="Bedienelemente", command=lambda: controller.show_frame(Page_0))
    button1.pack(side=tk.LEFT)

    button2 = tk.Button(top, text="Kräfte", command=lambda: controller.show_frame(Page_2))
    button2.pack(side=tk.LEFT)

    button3 = tk.Button(top, text="Druck", command=lambda: controller.show_frame(Page_2))
    button3.pack(side=tk.LEFT)

    button4 = tk.Button(top,text="Einstellungen",command=lambda: controller.show_frame(Page_2))
    button4.pack(side=tk.LEFT)

    button5 = tk.Button(top, text="QUIT", fg="red",command=quit)
    button5.pack(side=tk.LEFT)
    top.pack(side="top", expand=True, fill="both")
    # graph
    self.serialPlot = Plot()
    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))