def __init__(self, master, text="Position", **options): LabelFrame.__init__(self, master, text=text, **options) self.tracker = master.tracker self.listbox = Listbox(self) self.listbox.widget.configure(selectmode=SINGLE) self.listbox.grid(row=0, column=0, rowspan=6) self.name_frame = LabelFrame(self, text="Name") self.name_field = Entry(self.name_frame) self.name_field.grid() self.name_frame.grid(row=0, column=1) self.save_button = Button(self, text="Save current", command=bg_caller(self.save_position)) self.save_button.grid(row=1, column=1) self.go_to_button = Button(self, text="Go to", command=bg_caller(self.go_to_position)) self.go_to_button.grid(row=2, column=1) self.delete_button = Button(self, text="Delete", command=self.delete_position) self.delete_button.grid(row=3, column=1) self.write_button = Button(self, text="Write to file", command=self.write_to_file) self.write_button.grid(row=4, column=1) self.load_button = Button(self, text="Load from file", command=self.load_from_file) self.load_button.grid(row=5, column=1)
def __init__(self, master, text="Movement", **options): LabelFrame.__init__(self, master, text=text, **options) self.listbox = master.listbox self.board = master.board self.micron_frame = NamedEntryFrame(self, ("Microns",), parsers={"Microns": float}) self.micron_frame.grid(row=0, column=0, columnspan=2) self.move_button = Button(self, text="Move", command=bg_caller(self.move_actuators)) self.move_button.grid(row=1, column=0) self.move_absolute_button = Button(self, text="Move absolute", command=bg_caller(self.move_absolute)) self.move_absolute_button.grid(row=1, column=1)
def __init__(self, master, text="Basic commands", **options): LabelFrame.__init__(self, master, text=text, **options) self.tracker = master.tracker self.initialize_button = Button(self, text="Initialize", command=bg_caller(self.initialize)) self.initialize_button.grid(row=0, column=0) self.measure_button = Button(self, text="Measure once", command=bg_caller(self.measure)) self.measure_button.grid(row=0, column=1) self.abort_button = Button(self, text="Abort", command=self.abort) self.abort_button.grid(row=1, column=0) self.home_button = Button(self, text="Home", command=bg_caller(self.home)) self.home_button.grid(row=1, column=1)
def __init__(self, master, text="Modes", **options): LabelFrame.__init__(self, master, text=text, **options) self.tracker = master.tracker self.mode_menu = OptionMenu(self, (tracker.IFM_SET_BY_ADM, tracker.IFM, tracker.ADM)) self.mode_menu.grid(row=0, column=0) self.set_mode_button = Button(self, text="Set mode", command=bg_caller(self.set_mode)) self.set_mode_button.grid(row=0, column=1)
def __init__(self, master, text="Movement", **options): LabelFrame.__init__(self, master, text=text, **options) self.tracker = master.tracker self.coordinate_frame = NamedEntryFrame(self, ("Radius", "Theta", "Phi"), parsers={"Radius": float, "Theta": float, "Phi": float}) self.coordinate_frame.grid(row=0, column=0, rowspan=3) self.search_button = Button(self, text="Search", command=bg_caller(self.search)) self.search_button.grid(row=0, column=1) self.move_button = Button(self, text="Move", command=bg_caller(self.move_tracker)) self.move_button.grid(row=1, column=1) self.move_absolute_button = Button(self, text="Move (absolute)", command=bg_caller(self.move_absolute)) self.move_absolute_button.grid(row=2, column=1)
def __init__(self, master, tracker, text="Joystick", **options): LabelFrame.__init__(self, master, text=text, **options) self.tracker = tracker self.width = 400 self.height = 400 self.canvas = Canvas(self, height=self.height, width=self.width) self.canvas.grid() self.canvas.create_oval((self.width / 2 - 3, self.height / 2 - 3, self.width / 2 + 3, self.height / 2 + 3)) self.canvas.bind("<Button-1>", bg_caller(lambda event: self.move_tracker(event))) self.canvas.bind("<Motion>", self.update_label) self.motion_label = Label(self, text="", font=tkFont.Font(family="Courier")) self.motion_label.grid() f = LabelFrame(self, text="Sensitivity") self.sensitivity_scale = Scale(f, from_=0, to=10, resolution=0.01, orient=HORIZONTAL, length=self.width) self.sensitivity_scale.set(5) self.sensitivity_scale.grid() f.grid()
def __init__(self, master, tracker, text="Repositioning", **kwargs): LabelFrame.__init__(self, master, text=text, **kwargs) self.tracker = tracker self.source_selector = FileSelectionFrame(self, initial_dir=nodes_dir, ask_mode="open", text="Source") self.source_selector.grid(row=0, column=0) self.dest_selector = FileSelectionFrame(self, initial_dir=nodes_dir, ask_mode="save", text="Dest") self.dest_selector.grid(row=0, column=1) # The names and positions we gather: self.name_fields = [] self.posn_labels = [] self.training_info = [] for i in range(3): # Why three? Well, we need three training points to figure # out where all the other points are. Proof: take your # fist and move it around (it's a rigid structure, like # the arrangement of retroreflectors), and think about how # many points (e.g. knuckles) you'd need to know the # positions of to figure out the positions of all your # other knuckles. (It's three. If you disagree, please # think about it more until you agree, because I am # absolutely confident.) f = LabelFrame(self, text="(Name/position) ({})".format(i)) self.name_fields.append(Entry(f)) self.name_fields[-1].grid(row=0, column=0) self.posn_labels.append(Label(f, text="<None>")) self.posn_labels[-1].grid(row=0, column=1) b = Button(f, text="Set", command=bg_caller(deglobalize_args(self.set_position, i))) b.grid(row=0, column=2) f.grid(row=1+i, column=0, columnspan=2) self.training_info.append(None) Button(self, text="Compute/Save", command=self.save).grid(row=4, column=0)
def __init__(self, master, board, text="Actuators", *args, **kwargs): LabelFrame.__init__(self, master, text=text, *args, **kwargs) self.board = board # The listbox contains integers: port numbers we might # want to send messages out to through the Board. self.listbox = Listbox(self) self.listbox.widget.configure(selectmode=EXTENDED) self.listbox.grid(row=0, column=0, sticky='nsew') for i in range(192, 208, 2): self.listbox.add(i) self.movement_frame = MovementFrame(self) self.movement_frame.grid() self.get_status_button = Button(self, text="Get status", command=bg_caller(self.get_status)) self.get_status_button.grid() self.rowconfigure(0, weight=1) self.columnconfigure(0, weight=1)
def __init__(self, master, tracker, text="Measuring", *args, **kwargs): LabelFrame.__init__(self, master, text=text, *args, **kwargs) self.tracker = tracker self.config_frame = NamedEntryFrame(self, (OBS_INTERVAL, NUM_SAMPLES, NUM_OBSS), parsers={OBS_INTERVAL: float, NUM_SAMPLES: int, NUM_OBSS: int}) self.config_frame.grid() self.save_frame = LabelFrame(self, text="Saving") self.dest_selector = FileSelectionFrame(self.save_frame, ask_mode="save") self.dest_selector.grid(row=0, column=0, columnspan=2) self.save_button = Button(self.save_frame, text="Save", command=bg_caller(self.save)) self.save_button.grid(row=1, column=0) self.appending_var = BooleanVar() self.append_checkbutton = Checkbutton(self.save_frame, text="Append", variable=self.appending_var) self.append_checkbutton.grid(row=1, column=1) self.save_frame.grid()