Dear PyGTK folks, I want to make my application very responsive under high load. I've written a simple test application to demonstrate my problem in a clear way.
I attached the related code, but including here for easier discussion:
import gtk
import threading
def do_heavy_stuff():
for i in range(1, 100):
print `i+1` + '%'
k = 0
for j in range (1, 100000):
k += 1
def timerfunc(crap):
if not thread.isAlive():
window.remove(pbar)
window.add(label)
window.show_all()
pbar.pulse()
return thread.isAlive()
def destroy_handler(window):
gtk.main_quit()
window = gtk.Window(gtk.WINDOW_TOPLEVEL)
pbar = gtk.ProgressBar()
label = gtk.Label('Ready.')
window.connect('destroy', destroy_handler)
window.add(pbar)
window.set_default_size(200, 20)
window.show_all()
timer = gtk.timeout_add(100, timerfunc, pbar)
thread = threading.Thread(target=do_heavy_stuff)
thread.start()
gtk.main()
As you can see, I want to pulse a progress bar while a long
(computationally or I/O intensive) operation is running. I started a
separate thread for it.
I would expect this application to run do_heavy_stuff smoothly while
pulsing the progress bar simultaneously, but actually while the progress
bar is pulsing, nothing really happens. Only after colsing the window,
do_heavy_stuff begins to run.
So what could be wrong here?
Thank you very much in advance!
PS: I post this message to the list for the second time. The first time
when I posted I wasn't registered on the list and I've been waiting for
the approval for 3 weeks. I know resending is a bad policy, but I
cannot wait forever.
--
L�szl� Monda <http://mondalaci.objectis.net>
example.py
Description: application/python
_______________________________________________ pygtk mailing list [email protected] http://www.daa.com.au/mailman/listinfo/pygtk Read the PyGTK FAQ: http://www.async.com.br/faq/pygtk/
