我有一段Python代码,它应该在一段时间内打开一个新窗口,然后关闭该窗口。单击按钮可触发窗口。这是我的基本知识。在
def restore(self):
self.restore = Toplevel()
message = "Select an available Backup to Restore to."
Label(self.restore, text=message).pack()
# We then create and entry widget, pack it and then
# create two more button widgets as children to the frame.
os.chdir('.')
for name in os.listdir("."):
if os.path.isdir(name):
self.button = Button(self.restore, text=name,command=self.restoreCallBack)
self.button.pack(side=BOTTOM,padx=10)
def restoreCallBack(self):
self.restoreCB = Toplevel()
message = "Please wait while the database is restored..."
Label(self.restoreCB, text=message, padx=100, pady=20).pack()
time.sleep(5)
self.restore.destroy()
self.restoreCB.destroy()
我需要restoreCallBack窗口显示5秒钟,然后关闭窗口。谢谢!在
看看
after
方法。e、 g.:你不应该在GUI中使用sleep(主线程),整个事情都会冻结。在
相关问题 更多 >
编程相关推荐