wxpython automate progress bar
Chris Mellon
arkanes at gmail.com
Sat Sep 8 14:52:05 EDT 2007
On 9/8/07, Jimmy <mcknight0219 at gmail.com> wrote:
> Hi, I want a progress bar to increase automatically, so I wrote code
> like this:
> current = 0
> while True:
> if current == 100:
> current = 0
> self._gauge.SetValue(current)
> time.sleep(0.1)
> current = current + 1
>
> I put this in the __init__ section, however, the window will never
> show! and there are
> error message like this:
> ** (python:28543): CRITICAL **: clearlooks_style_draw_handle:
> assertion `width >= -1' failed
>
> can anyone tell me why this happen?Thanks :)
>
Because you are blocking the event loop so while you are doing this
your application isn't running and not painting. Use a wx.Timer
instead.
Why are you lying to your users about what you are doing and how long
it is taking anyway?
More information about the Python-list
mailing list