Updating PyQt widgets question

E

Eric Williams

Hello all,

I'm working on a little application using PyQt. The main window is just a
dialog with 2 progress bars and a few labels. In its original form, the
dialog started, then ran a function which downloaded a directory full of
files from an ftp server, using an ftplib.FTP object's retrbinary function.

http://xoffender.de/Downloads/screenie4.png

Now, inside the callback function of the retrbinary call, I was calling the
progress bars' setProgress function, and the labels' setText functions.
What happened was, the progress bars got updated, albeit sporadically, but
the labels didn't. They only changed once the function was completed.

I've changed this now so that the download process runs in a thread, and I
use a self.startTimer(50) call with a timerEvent function that updates the
progress bars and labels by reading variables out of the thread. This works
perfectly, as far as I can tell, but I still have 2 questions:

- Is the above result (with the non-updating labels) the expected behavior,
or did I do something wrong?
- Is the thread/timer combination the 'correct' way to do it? I also tried
connecting emit() signals within the thread to updating slot() functions in
the dialog, which worked but seemed a little chaotic.

Thanks!
Eric
 

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,768
Messages
2,569,575
Members
45,053
Latest member
billing-software

Latest Threads

Top