def create_root(self): """ Description ----------- Sets up all the parameters for the gui (text, buttons, entry boxes, etc.) Returns ------- None """ self.root = tk.Tk() self.root.title('Ultra Deluxe Focus Control Hub EXTREME') self.root.geometry('430x140') connection_text = tk.Label(self.root, text='The focuser is connected to: ') connection_text.grid(row=1, column=1) self.comport_var = tk.StringVar() self.comport_var.set(self.focuser.comport) self.comport = tk.Label(self.root, textvariable=self.comport_var) self.comport.grid(row=1, column=2) self.position = tk.IntVar() self.position.set(self.focuser.position) position_msg = tk.Label(self.root, text='The current position is: ') position_msg.grid(row=2, column=1) self.position_text = tk.Label(self.root, textvariable=self.position) self.position_text.grid(row=2, column=2) self.delta = tk.IntVar() self.delta.set(config_reader.get_config().initial_focus_delta) delta_entry = tk.Entry(self.root, textvariable=self.delta, width=5) delta_entry.grid(row=3, column=2) button_frame = tk.Frame(self.root) self.move_in = tk.Button( button_frame, text='MOVE IN', state=tk.DISABLED, command=lambda: self.move_in_cmd(self.delta.get())) self.move_out = tk.Button( button_frame, text='MOVE OUT', state=tk.DISABLED, command=lambda: self.move_out_cmd(self.delta.get())) button_frame.grid(row=3, column=1, sticky="nsew", pady=10, padx=20) self.move_in.pack(side="left") self.move_out.pack(side="right") abort = tk.Button(self.root, text='ABORT', command=self.abort_cmd, width=15) abort.grid(row=4, column=1, columnspan=2)
def makeView(self, master): bg = master.cget('bg') frame = mtk.Frame(master, bg=bg) checkbuttonState = mtk.IntVar() checkbuttonState.set(int(self.state)) b = mtk.Checkbutton(frame, variable=checkbuttonState, anchor='w', bg=bg, command = self.onClick, highlightthickness=0, bd=0, selectcolor=self.selectColor) b.pack(padx=5, pady=5) return frame
def __init__(self, master, queue, endCommand): self.queue = queue self.status_label = dict() #Set up the GUI r = -1 # XBotCore Dummy r += 1 tk.Button(master, text='Run XBotCore', font='Helvetica 18 bold', command=xbot).grid(row=r, column=0, pady=20) # plugins r += 1 create_plugin_control(master, 'HomingExample', r, self.status_label) r += 1 create_plugin_control(master, 'XBotCommunicationPlugin', r, self.status_label) r += 1 create_plugin_control(master, 'HeriHand', r, self.status_label) # HeriHand control percentage = tk.StringVar(root, value='0.0') #percentage.trace("w", lambda name, index, mode, percentage=percentage: callback(percentage)) r += 1 tk.Button(master, text="Grasp", font='Calibri 12', command=lambda: heri_control("grasp", percentage)).grid( row=r, column=1, pady=20) tk.Button(master, text="Pinch", font='Calibri 12', command=lambda: heri_control("pinch", percentage)).grid( row=r, column=2) tk.Button(master, text="Tool Grasp", font='Calibri 12', command=lambda: heri_control("tool_grasp", percentage)).grid( row=r, column=3) tk.Button( master, text="Tool Trigger", font='Calibri 12', command=lambda: heri_control("tool_trigger", percentage)).grid( row=r, column=4) r += 1 tk.Label( master, text="Closure (0.0 to 1.0)", font='Calibri 12', ).grid(row=r, column=1, sticky=tk.W, padx=20, pady=20) e1 = tk.Entry(master, textvariable=percentage) e1.grid(row=r, column=2) #e1 = Entry(master) #e2 = Entry(master) # CI b = tk.Button(master, text='Cartesian Interface', font='Helvetica 12 bold', command=lambda: cartesian_interface()) r += 1 b.grid(row=r, column=0, rowspan=2, pady=20) b.config(bg='cyan') v = tk.IntVar() c1 = tk.Radiobutton(master, text='WheeledMotion', font='Helvetica 12', variable=v, value=0, command=lambda: load_controller('WheeledMotion')) c1.grid(row=r, column=1, pady=20, sticky=tk.W) r += 1 c2 = tk.Radiobutton(master, text='OpenSot', font='Helvetica 12', variable=v, value=1, command=lambda: load_controller('OpenSot')) c2.grid(row=r, column=1, sticky=tk.W) #Quit tk.Button(master, text='Quit', font='Helvetica 12', command=endCommand).grid(column=0, pady=20)