一定期間新しいウィンドウを開いてからウィンドウを閉じることになっている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 秒間表示してから、ウィンドウを閉じる必要があります。ありがとう!