problem understanding pygtk

Nemesis nemesis at nowhere.invalid
Thu Oct 28 21:29:25 CEST 2004


Mentre io pensavo ad una intro simpatica "Samuele Giovanni Tonon"
scriveva:

> hi,
> i'm trying to develop a trivial application which random copy files
> from a directory to another one.
>
> i made it using pygtk for the graphical interface, however i find 
> some problem with progressbar and ListStore:
>
> basically i need to make pulse the progressbar while i'm copying files
> and write filenames copied on the ListStore on to the window.
>
> However while copying the window is frozen, even if files are copied
> one by one and when the copy process finish the window is updated
> suddenly.
> This behaviour is well shown if i try to copy files to slow devices
> such as usb disk.

you should use:

while gtk.events_pending():
    gtk.mainiteration(gtk.FALSE) 

in the loop, it requests a refresh of the gui. 
So if you use a loop to iterate over a list of files insert that two
lines in the loop, and your gui will be refreshed every iteration.
-- 
I quit drinking and smoking once. Very boring 15 minutes.
 
 |\ |       |HomePage   : http://nem01.altervista.org
 | \|emesis |XPN (my nr): http://xpn.altervista.org




More information about the Python-list mailing list