Python Tkinter 有刷新方法吗?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/19477636/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Does Tkinter have a refresh method?
提问by gadss
I am using Tkinter.
我正在使用 Tkinter。
import Tkinter as tk
class App(tk.Frame):
def __init__(self, *args, **kwargs):
tk.Frame.__init__(self, *args, **kwargs)
....
root = tk.Tk()
root.title("title")
app = App(root)
root.mainloop()
Does it has a refresh? Because I want to refresh my frame.
Is root.refresh()
is possible?
它有刷新吗?因为我想刷新我的框架。是root.refresh()
有可能吗?
回答by Junuxx
There is a Tk.update()and a Tk.update_idletasks(). Both will force the UI to be refreshed, but depending on what you're actually trying to do it might not be what you're looking for.
有一个Tk.update()和一个Tk.update_idletasks()。两者都会强制刷新 UI,但取决于您实际尝试执行的操作,它可能不是您要查找的内容。