wxProgressDialog wonky under Win32
Grant Edwards
grante at visi.com
Mon Mar 11 12:55:24 EST 2002
Under Win32, the bargraph in a wxProgressDialog hits "full"
about 10-20% of the way to the "max" value. The attached
program illustrates this. The "cacnel" button changes to
"close" at the correct point, it's just the bargraph that
doesn't work right.
It works fine under:
RH7.2, Python 2.1.1, GTK 1.2.10, wxPython 2.3.2
Barphraph shows wonky behavior under:
Win2K, Python 2.2, wxPython 2.3.2
Does anybody know how to get the bargraph to work right under
windows?
------------------------------8<------------------------------
import time
from wxPython.wx import *
class MyButton(wxButton):
def __init__(self, parent, ident, *argt, **argd):
c = None
if argd.has_key("command"):
c = argd["command"]
del argd["command"]
wxButton.__init__(self, parent, ident, *argt, **argd)
if c:
EVT_BUTTON(self,self.GetId(),c)
class MyFrame(wxFrame):
def __init__(self, *argt, **argd):
wxFrame.__init__(self, *argt, **argd)
sv = wxBoxSizer(wxVERTICAL)
sv.Add(MyButton(self,-1,"Go",command=self.progress))
self.SetSizer(sv)
self.SetAutoLayout(1)
sv.Fit(self)
self.Show(1)
def progress(self,event):
size = 500000
dlg = wxProgressDialog("Downloading",
"Downloading...",
size,
self,
wxPD_CAN_ABORT | wxPD_APP_MODAL)
bytes = 0
while bytes < size:
time.sleep(0.1)
bytes += 10000
print bytes
if not dlg.Update(bytes):
break
class MyApp(wxApp):
def OnInit(self):
frame = MyFrame(NULL, -1, "Download")
frame.Show(true)
self.SetTopWindow(frame)
return true
MyApp(0).MainLoop()
------------------------------8<------------------------------
--
Grant Edwards grante Yow! LOOK!!! I'm WALKING
at in my SLEEP again!!
visi.com
More information about the Python-list
mailing list