def _create_button(self, text, x, command): button = tk.Button(self.driver.canvas, text=text, height=2, command=command) button_window = self._create_window(x, button) return button, button_window
def __init__(self, root, canvas): self.root = root self.canvas = canvas frame = tk.Frame(root) pane = tk.PanedWindow(frame) pane.pack(fill=tk.BOTH, expand=1) self.yaw_scale = self.add_scale(pane, 'Yaw', self.yaw_callback) self.pitch_scale = self.add_scale(pane, 'Pitch', self.pitch_callback) self.roll_scale = self.add_scale(pane, 'Roll', self.roll_callback) tk.Button(pane, text='Reset', command=self.reset).pack() pane.pack() frame.pack() self.reset() self.active_axis = 0
def _add_button(self, label, parent, callback, disabled=True): button = tk.Button(parent, text=label, command=callback) button.pack(side=tk.LEFT) button.config(state='disabled' if disabled else 'normal') return button