import tkinter as tk import time import queue import gui.graph as Graph class MainWindow(tk.Frame): def __init__(self, root, up_queue, down_queue,calibration_state): self.root = root self.calibration_state = calibration_state self.down_queue = down_queue self.up_queue = up_queue tk.Frame.__init__(self, root) self.graph = Graph.Graph(self) self.graph.pack(fill=tk.BOTH, side=tk.LEFT, expand=True) self.controls = tk.Frame(self) self.controls.pack(fill=tk.BOTH, side=tk.RIGHT) l = tk.Label(self.controls, text="your widgets go here...", anchor="c") l.pack(side="top", fill="both", expand=True) calibrate_button = tk.Button(self.controls,text="calibrate",command=self.calibrate) calibrate_button.pack(side="top") calibrate_button_next = tk.Button(self.controls,text="calibrate_next",command=self.calibration_state.next_state) calibrate_button_next.pack(side="top") self.csString = tk.StringVar() cs = tk.Label(self.controls, textvariable=self.csString, anchor="c") cs.pack(side="top", fill="both", expand=True) def update(self): self.graph.update() self.csString.set(self.calibration_state.state_clearname()) self.root.after(30, self.update) def calibrate(self): self.calibration_state.reset_state() self.calibration_state.next_state() self.down_queue.put("calibrate") def start_mainwindow(up_queue,down_queue,calibration_sate): root = tk.Tk() root.title("Tracking System") view = MainWindow(root,up_queue,down_queue,calibration_sate) view.pack(side="top", fill="both", expand=True) view.update() root.mainloop() if __name__ == "__main__": root = tk.Tk() up_queue = queue.Queue() down_queue = queue.Queue() root.title("Tracking System") view = MainWindow(root,up_queue,down_queue,list()) view.pack(side="top", fill="both", expand=True) view.update() root.mainloop()