[wxPython-users] Auto-pulsing wxProgressDialog?
Rooney, Mike (ext. 324)
mxr at qvii.com
Wed Jan 3 08:18:13 PST 2007
>Recent version of wxPython include a library called
>wx.lib.delayedresult which can help with this, it is featured in the
>demo under the process and events category.
I gave it a shot but the same thing happens. I just don't understand!
I replaced the database call with a sleep call just to simplify even
more but still no pulsing occurs.
Let me post a little code and maybe it will be clear what I am doing
wrong. onPack in the controller is what is called first. It tells the
view to show the dialog, which is supposed to start a timer but it
never pulses and 12 never gets printed.
in the controller:
def onPack(self, event=None):
self.view.showPackDialog()
import time, wx.lib.delayedresult as delayedresult
delayedresult.startWorker(self.onPackDone, lambda:time.sleep(5))
def onPackDone(self, result):
self.view.closePackDialog()
in the view:
def showPackDialog(self):
self.dlg = wx.ProgressDialog("Packing Database", "Packing routines in the ZopeDB", parent=self)
self.t = wx.Timer(self)
self.t.Bind(wx.EVT_TIMER, self.onPackTimer)
self.t.Start(10)
def onPackTimer(self, e):
print 12 #debug
self.dlg.Pulse()
def closePackDialog(self):
self.t.Stop()
self.dlg.Destroy()
Thanks for your help so far, it is greatly appreciated. Hopefully the
code is clean and easy to interpret (no pun intended).
---------------------------------------------------------------------
To unsubscribe, e-mail: wxPython-users-unsubscribe at lists.wxwidgets.org
For additional commands, e-mail: wxPython-users-help at lists.wxwidgets.org
More information about the wxpython-users
mailing list