本文整理汇总了Python中Tkinter.mainloop方法的典型用法代码示例。如果您正苦于以下问题:Python Tkinter.mainloop方法的具体用法?Python Tkinter.mainloop怎么用?Python Tkinter.mainloop使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Tkinter
的用法示例。
在下文中一共展示了Tkinter.mainloop方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __init__
# 需要导入模块: import Tkinter [as 别名]
# 或者: from Tkinter import mainloop [as 别名]
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()
示例2: _quit
# 需要导入模块: import Tkinter [as 别名]
# 或者: from Tkinter import mainloop [as 别名]
def _quit():
root.quit() # stops mainloop
root.destroy() # this is necessary on Windows to prevent
# Fatal Python Error: PyEval_RestoreThread: NULL tstate
示例3: plot
# 需要导入模块: import Tkinter [as 别名]
# 或者: from Tkinter import mainloop [as 别名]
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()
示例4: run
# 需要导入模块: import Tkinter [as 别名]
# 或者: from Tkinter import mainloop [as 别名]
def run(self):
tk.mainloop()
示例5: exitonclick
# 需要导入模块: import Tkinter [as 别名]
# 或者: from Tkinter import mainloop [as 别名]
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)
示例6: mainloop
# 需要导入模块: import Tkinter [as 别名]
# 或者: from Tkinter import mainloop [as 别名]
def mainloop(self):
Tk.mainloop()
示例7: disp_plot
# 需要导入模块: import Tkinter [as 别名]
# 或者: from Tkinter import mainloop [as 别名]
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()
示例8: main
# 需要导入模块: import Tkinter [as 别名]
# 或者: from Tkinter import mainloop [as 别名]
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)
示例9: main
# 需要导入模块: import Tkinter [as 别名]
# 或者: from Tkinter import mainloop [as 别名]
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()
示例10: main
# 需要导入模块: import Tkinter [as 别名]
# 或者: from Tkinter import mainloop [as 别名]
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()
示例11: main
# 需要导入模块: import Tkinter [as 别名]
# 或者: from Tkinter import mainloop [as 别名]
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()
示例12: main
# 需要导入模块: import Tkinter [as 别名]
# 或者: from Tkinter import mainloop [as 别名]
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()
示例13: main
# 需要导入模块: import Tkinter [as 别名]
# 或者: from Tkinter import mainloop [as 别名]
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()
示例14: main
# 需要导入模块: import Tkinter [as 别名]
# 或者: from Tkinter import mainloop [as 别名]
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()
示例15: main
# 需要导入模块: import Tkinter [as 别名]
# 或者: from Tkinter import mainloop [as 别名]
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()