本文整理汇总了Python中Tkinter.Tk.after_idle方法的典型用法代码示例。如果您正苦于以下问题:Python Tk.after_idle方法的具体用法?Python Tk.after_idle怎么用?Python Tk.after_idle使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Tkinter.Tk
的用法示例。
在下文中一共展示了Tk.after_idle方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __init__
# 需要导入模块: from Tkinter import Tk [as 别名]
# 或者: from Tkinter.Tk import after_idle [as 别名]
class gui:
def __init__(self):
self.tk = Tk()
self.canvas = Canvas(self.tk)
self.tk.after_idle(self.test)
self.tk.mainloop()
def test(self):
print 'boom'
self.tk.after(200, self.test2)
def test2(self):
print 'bang'
self.tk.after(200, self.test)
示例2: repr
# 需要导入模块: from Tkinter import Tk [as 别名]
# 或者: from Tkinter.Tk import after_idle [as 别名]
total, lags, visibility, phase_fit, m, c) = correlator.get_correlation()
baseline = left, right
logger.debug('received baseline %s' % repr(baseline))
except NoCorrelations:
widget.after(1, update_plots, widget, baselines)
return # it never comes to this
if baseline not in baselines.keys():
corr.axes.grid()
#corr.axes.set_xlabel('Lag', size='large')
#corr.axes.set_ylabel('Correlation Function', size='large')
phase_line = corr.plot(f, angle(visibility), '%so' % colors[current%len(colors)], linewidth=1, label=repr(baseline))[0]
fit_line = corr.plot(f, real(phase_fit), '%s-' % colors[current%len(colors)], linewidth=1, label=None)[0]
baselines[baseline] = phase_line, fit_line
else:
corr.axes.legend()
phase_line, fit_line = baselines[baseline]
corr.update_line(phase_line, f, angle(visibility))
corr.update_line(fit_line, f, real(phase_fit))
if current == total-1:
widget.update()
logger.info('update in')
widget.after_idle(update_plots, widget, baselines)
root.update()
root.geometry(frame.winfo_geometry())
root.after_idle(update_plots, root, {})
root.deiconify()
root.mainloop()
示例3: guiLogin
# 需要导入模块: from Tkinter import Tk [as 别名]
# 或者: from Tkinter.Tk import after_idle [as 别名]
def guiLogin(title, default_username="", default_password=""):
from Tkinter import Tk, N, S, W, E, StringVar
import ttk
root = Tk()
root.title(title)
mainframe = ttk.Frame(root, padding="3 3 12 12")
mainframe.grid(column=0, row=0, sticky=(N, W, E, S))
mainframe.columnconfigure(0, weight=1)
mainframe.rowconfigure(0, weight=1)
username = StringVar()
username.set(default_username)
password = StringVar()
password.set(default_password)
def done(*args):
root.destroy()
ttk.Label(mainframe, text="Username:").grid(column=1, row=1, sticky=(W, E))
username_entry = ttk.Entry(mainframe, width=7, textvariable=username)
username_entry.grid(column=2, row=1, sticky=(W, E))
ttk.Label(mainframe, text="Password:").grid(column=1, row=2, sticky=(W, E))
pass_entry = ttk.Entry(mainframe, width=7, textvariable=password, show="*")
pass_entry.grid(column=2, row=2, sticky=(W, E))
ttk.Button(mainframe, text="Login", command=done).grid(column=2, row=3, sticky=W)
for child in mainframe.winfo_children(): child.grid_configure(padx=5, pady=2)
username_entry.focus()
root.bind('<Return>', done)
root.bind('<Escape>', lambda event: root.destroy())
root.lift()
root.call('wm', 'attributes', '.', '-topmost', True)
root.after_idle(root.call, 'wm', 'attributes', '.', '-topmost', False)
root.mainloop()
return username.get(), password.get()
示例4: guiLogin
# 需要导入模块: from Tkinter import Tk [as 别名]
# 或者: from Tkinter.Tk import after_idle [as 别名]
def guiLogin():
root = Tk()
root.title("Enter Lastpass login")
mainframe = ttk.Frame(root, padding="3 3 12 12")
mainframe.grid(column=0, row=0, sticky=(N, W, E, S))
mainframe.columnconfigure(0, weight=1)
mainframe.rowconfigure(0, weight=1)
username = StringVar()
password = StringVar()
ret = []
def done(*args):
ret.append((username.get(), password.get()))
root.destroy()
ttk.Label(mainframe, text="Username:").grid(column=1, row=1, sticky=(W, E))
username_entry = ttk.Entry(mainframe, width=7, textvariable=username)
username_entry.grid(column=2, row=1, sticky=(W, E))
ttk.Label(mainframe, text="Password:").grid(column=1, row=2, sticky=(W, E))
pass_entry = ttk.Entry(mainframe, width=7, textvariable=password)
pass_entry.grid(column=2, row=2, sticky=(W, E))
ttk.Button(mainframe, text="Login", command=done).grid(column=2, row=3, sticky=W)
for child in mainframe.winfo_children(): child.grid_configure(padx=5, pady=2)
username_entry.focus()
root.bind('<Return>', done)
root.bind('<Escape>', lambda event: root.destroy())
root.lift()
root.call('wm', 'attributes', '.', '-topmost', True)
root.after_idle(root.call, 'wm', 'attributes', '.', '-topmost', False)
root.mainloop()
return ret and ret[-1] or None