【发布时间】:2016-09-20 00:51:57
【问题描述】:
我无法关闭 wx.ProgressDialog。如果过期;一切安好。单击取消或跳过将跳出对话框,但窗口在屏幕上永远保持冻结状态(控制流返回)。
import wx
def Progress(parent=None, message="", title="", maximum=3000):
dlg = wx.GenericProgressDialog(title, message, maximum,style=wx.PD_AUTO_HIDE|wx.PD_APP_MODAL|wx.PD_CAN_SKIP|wx.PD_CAN_ABORT)
keepGoing = True
skip = False
count = 0
while keepGoing and (not skip) and count < maximum:
count += 1
wx.MilliSleep(1)
wx.Yield()
(keepGoing, skip_bogus) = dlg.Update(count)
skip = dlg.WasSkipped() #NOTE: skip_bogus doesn't ever seem to update; even when skip button is clicked
dlg.Destroy()
wx.Yield()
if not keepGoing:
return "cancel"
elif skip:
return "skip"
else:
return None
app = wx.App()
app.MainLoop()
Progress(None, "message", "title")
wxpython v3.0.2 python v2.7.10
【问题讨论】:
标签: wxpython