Python Tkinter.mainloop() Examples
The following are 22
code examples of Tkinter.mainloop().
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example.
You may also want to check out all available functions/classes of the module
Tkinter
, or try the search function
.
Example #1
Source File: turtle.py From Splunking-Crime with GNU Affero General Public License v3.0 | 5 votes |
def exitonclick(self): """Go into mainloop until the mouse is clicked. No arguments. Bind bye() method to mouseclick on TurtleScreen. If "using_IDLE" - value in configuration dictionary is False (default value), enter mainloop. If IDLE with -n switch (no subprocess) is used, this value should be set to True in turtle.cfg. In this case IDLE's mainloop is active also for the client script. This is a method of the Screen-class and not available for TurtleScreen instances. Example (for a Screen instance named screen): >>> screen.exitonclick() """ def exitGracefully(x, y): """Screen.bye() with two dummy-parameters""" self.bye() self.onclick(exitGracefully) if _CFG["using_IDLE"]: return try: mainloop() except AttributeError: exit(0)
Example #2
Source File: annotate_street_markings.py From self-driving-truck with MIT License | 5 votes |
def main(): print("Loading replay memory...") memory = replay_memory.ReplayMemory.create_instance_supervised() win = GridAnnotationWindow.create( memory, current_anno_attribute_name="street_markings_grid", save_to_fp="annotations_street_markings.pickle", every_nth_example=20 ) win.brush_size = 2 win.autosave_every_nth = 100 win.master.wm_title("Annotate street markings") Tkinter.mainloop()
Example #3
Source File: annotate_attributes.py From self-driving-truck with MIT License | 5 votes |
def main(): print("Loading replay memory...") memory = replay_memory.ReplayMemory.create_instance_supervised() win = AttributesAnnotationWindow.create( memory, save_to_fp="annotations_attributes.pickle", every_nth_example=25 ) win.autosave_every_nth = 100 win.master.wm_title("Annotate attributes") Tkinter.mainloop()
Example #4
Source File: annotate_cars.py From self-driving-truck with MIT License | 5 votes |
def main(): print("Loading replay memory...") memory = replay_memory.ReplayMemory.create_instance_supervised() win = GridAnnotationWindow.create( memory, current_anno_attribute_name="cars_grid", save_to_fp="annotations_cars.pickle", every_nth_example=5 ) win.brush_size = 3 win.autosave_every_nth = 200 win.master.wm_title("Annotate cars") Tkinter.mainloop()
Example #5
Source File: annotate_crashables.py From self-driving-truck with MIT License | 5 votes |
def main(): print("Loading replay memory...") memory = replay_memory.ReplayMemory.create_instance_supervised() win = GridAnnotationWindow.create( memory, current_anno_attribute_name="crashables_grid", save_to_fp="annotations_crashables.pickle", every_nth_example=20 ) win.brush_size = 3 win.autosave_every_nth = 100 win.master.wm_title("Annotate crashables") Tkinter.mainloop()
Example #6
Source File: annotate_lanes_same_direction.py From self-driving-truck with MIT License | 5 votes |
def main(): print("Loading replay memory...") memory = replay_memory.ReplayMemory.create_instance_supervised() win = GridAnnotationWindow.create( memory, current_anno_attribute_name="lanes_same_direction_grid", save_to_fp="annotations_lanes_same_direction.pickle", every_nth_example=20 ) win.brush_size = 2 win.autosave_every_nth = 100 win.master.wm_title("Annotate lanes same direction") Tkinter.mainloop()
Example #7
Source File: annotate_current_lane.py From self-driving-truck with MIT License | 5 votes |
def main(): print("Loading replay memory...") memory = replay_memory.ReplayMemory.create_instance_supervised() win = GridAnnotationWindow.create( memory, current_anno_attribute_name="current_lane_grid", save_to_fp="annotations_current_lane.pickle", every_nth_example=20 ) win.brush_size = 2 win.autosave_every_nth = 100 win.master.wm_title("Annotate current lane") Tkinter.mainloop()
Example #8
Source File: annotate_cars_mirrors.py From self-driving-truck with MIT License | 5 votes |
def main(): print("Loading replay memory...") memory = replay_memory.ReplayMemory.create_instance_supervised() win = GridAnnotationWindow.create( memory, current_anno_attribute_name="cars_mirrors_grid", save_to_fp="annotations_cars_mirrors.pickle", every_nth_example=5 ) win.brush_size = 3 win.autosave_every_nth = 200 win.master.wm_title("Annotate cars mirrors") Tkinter.mainloop()
Example #9
Source File: demo.py From PyCV-time with MIT License | 5 votes |
def run(self): tk.mainloop()
Example #10
Source File: demo.py From PyCV-time with MIT License | 5 votes |
def run(self): tk.mainloop()
Example #11
Source File: kimmo.py From razzy-spinner with GNU General Public License v3.0 | 5 votes |
def __init__(self, imagefileName, title): self._root = Tkinter.Toplevel() self._root.title(title + ' (' + imagefileName + ')') self.image = Tkinter.PhotoImage("LGraph",file=imagefileName) Tkinter.Label(self._root, image=self.image).pack(side='top',fill='x') # self._root.mainloop()
Example #12
Source File: svm_gui.py From sklearn_pydata2015 with BSD 3-Clause "New" or "Revised" License | 5 votes |
def main(argv): op = get_parser() opts, args = op.parse_args(argv[1:]) root = Tk.Tk() model = Model() controller = Controller(model) root.wm_title("Scikit-learn Libsvm GUI") view = View(root, controller) model.add_observer(view) Tk.mainloop() if opts.output: model.dump_svmlight_file(opts.output)
Example #13
Source File: plot_wing.py From OpenAeroStruct with Apache License 2.0 | 5 votes |
def disp_plot(args=sys.argv): disp = Display(args) disp.draw_GUI() plt.tight_layout() disp.root.protocol("WM_DELETE_WINDOW", disp.quit) Tk.mainloop()
Example #14
Source File: plot_wingbox.py From OpenAeroStruct with Apache License 2.0 | 5 votes |
def disp_plot(args=sys.argv): disp = Display(args) disp.draw_GUI() plt.tight_layout() disp.root.protocol("WM_DELETE_WINDOW", disp.quit) Tk.mainloop()
Example #15
Source File: backend_tkagg.py From matplotlib-4-abaqus with MIT License | 5 votes |
def mainloop(self): Tk.mainloop()
Example #16
Source File: turtle.py From oss-ftp with MIT License | 5 votes |
def exitonclick(self): """Go into mainloop until the mouse is clicked. No arguments. Bind bye() method to mouseclick on TurtleScreen. If "using_IDLE" - value in configuration dictionary is False (default value), enter mainloop. If IDLE with -n switch (no subprocess) is used, this value should be set to True in turtle.cfg. In this case IDLE's mainloop is active also for the client script. This is a method of the Screen-class and not available for TurtleScreen instances. Example (for a Screen instance named screen): >>> screen.exitonclick() """ def exitGracefully(x, y): """Screen.bye() with two dummy-parameters""" self.bye() self.onclick(exitGracefully) if _CFG["using_IDLE"]: return try: mainloop() except AttributeError: exit(0)
Example #17
Source File: backend_tkagg.py From Computable with MIT License | 5 votes |
def mainloop(self): Tk.mainloop()
Example #18
Source File: turtle.py From BinderFilter with MIT License | 5 votes |
def exitonclick(self): """Go into mainloop until the mouse is clicked. No arguments. Bind bye() method to mouseclick on TurtleScreen. If "using_IDLE" - value in configuration dictionary is False (default value), enter mainloop. If IDLE with -n switch (no subprocess) is used, this value should be set to True in turtle.cfg. In this case IDLE's mainloop is active also for the client script. This is a method of the Screen-class and not available for TurtleScreen instances. Example (for a Screen instance named screen): >>> screen.exitonclick() """ def exitGracefully(x, y): """Screen.bye() with two dummy-parameters""" self.bye() self.onclick(exitGracefully) if _CFG["using_IDLE"]: return try: mainloop() except AttributeError: exit(0)
Example #19
Source File: demo.py From OpenCV-Python-Tutorial with MIT License | 5 votes |
def run(self): tk.mainloop()
Example #20
Source File: PiScope.py From PiScope with MIT License | 5 votes |
def plot(self): if len(self.channels) < 1 or len(self.channels) > 2: print "The device can either operate as oscilloscope (1 channel) or x-y plotter (2 channels). Please operate accordingly." self._quit() else: print "Plotting will start in a new window..." try: # Setup Quit button button = Tkinter.Button(master=self.root, text='Quit', command=self._quit) button.pack(side=Tkinter.BOTTOM) # Setup speed and width self.scale1 = Tkinter.Scale(master=self.root,label="View Width:", from_=3, to=1000, sliderlength=30, length=self.ax.get_window_extent().width, orient=Tkinter.HORIZONTAL) self.scale2 = Tkinter.Scale(master=self.root,label="Generation Speed:", from_=1, to=200, sliderlength=30, length=self.ax.get_window_extent().width, orient=Tkinter.HORIZONTAL) self.scale2.pack(side=Tkinter.BOTTOM) self.scale1.pack(side=Tkinter.BOTTOM) self.scale1.set(4000) self.scale2.set(self.scale2['to']-10) self.root.protocol("WM_DELETE_WINDOW", self._quit) if len(self.channels) == 1: self.values = [] else: self.valuesx = [0 for x in range(4000)] self.valuesy = [0 for y in range(4000)] self.root.after(4000, self.draw) Tkinter.mainloop() except Exception, err: print "Error. Try again." print err self._quit()
Example #21
Source File: Emotion Recognition.py From Emotion-Recognition-Using-SVMs with MIT License | 5 votes |
def _quit(): root.quit() # stops mainloop root.destroy() # this is necessary on Windows to prevent # Fatal Python Error: PyEval_RestoreThread: NULL tstate
Example #22
Source File: annotate_street_boundaries.py From self-driving-truck with MIT License | 4 votes |
def main(): print("Loading replay memory...") memory = replay_memory.ReplayMemory.create_instance_supervised() print("Loading previous annotations...") annotations = load_annotations() #is_annotated = dict([(str(annotation.idx), True) for annotation in annotations]) current_state_idx = memory.id_min if annotations is not None: while current_state_idx < memory.id_max: key = str(current_state_idx) if not key in annotations: break current_state_idx += EVERY_NTH print("ID of first unannotated state: %d" % (current_state_idx,)) master = Tkinter.Tk() state = memory.get_state_by_id(current_state_idx) canvas_height = state.screenshot_rs.shape[0] * ZOOM_FACTOR canvas_width = state.screenshot_rs.shape[1] * ZOOM_FACTOR print("canvas height, width:", canvas_height, canvas_width) canvas = Tkinter.Canvas(master, width=canvas_width, height=canvas_height) canvas.pack() canvas.focus_set() #y = int(canvas_height / 2) #w.create_line(0, y, canvas_width, y, fill="#476042") message = Tkinter.Label(master, text="Click to draw annotation. Press E to switch to eraser mode. Press S to save. Use Numpad +/- for brush size.") message.pack(side=Tkinter.BOTTOM) window_state = WindowState(master, canvas, memory, current_state_idx, annotations) #canvas.bind("<Button-1>", OnPaint(window_state)) #master.bind("<Button-1>", lambda event: print(event)) #master.bind("<Button-3>", lambda event: print("right", event)) #master.bind("<ButtonPress-1>", lambda event: print("press", event)) master.bind("<B1-Motion>", OnLeftMouseButton(window_state)) #master.bind("<ButtonRelease-1>", lambda event: print("release", event)) master.bind("<B3-Motion>", OnRightMouseButton(window_state)) canvas.bind("<e>", lambda event: window_state.toggle_eraser()) canvas.bind("<s>", lambda event: window_state.save_annotations(force=True)) canvas.bind("<w>", lambda event: window_state.toggle_heatmap()) canvas.bind("<Left>", lambda event: window_state.previous_state(autosave=True)) canvas.bind("<Right>", lambda event: window_state.next_state(autosave=True)) canvas.bind("<KP_Add>", lambda event: window_state.increase_brush_size()) canvas.bind("<KP_Subtract>", lambda event: window_state.decrease_brush_size()) Tkinter.mainloop()