wxpython automate progress bar

J

Jimmy

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 :)
 
C

Chris Mellon

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?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,770
Messages
2,569,583
Members
45,074
Latest member
StanleyFra

Latest Threads

Top