Pygtk progress bar not updating

Now the thing which we will be wanting to run is a generator, call it"take_really_long".

And it will surely block, and might be a bit intensive, andwell we obviously need something asynchronous.

In the response header, there’s a field called “Content-Length”, which is used to indicate size of the response body.

Since response body here is the file content, so this “Content-Length” is what we’re looking for.

So we can get file size like this: And next, we need know how many bytes we have downloaded.

the read(n) method of response object will receive n bytes of data from server.

I moved it inside the class and forgot to take out the threads=None in the Py App class constructor.



Following code will create a window and put a progress bar in it. Qt Gui import * class Downloading Window(QWidget): def __init__(self): QWidget.__init__(self) vbox = QVBox Layout() label = QLabel('downloading..') Alignment(Qt.Actually read() can be called with no parameter, then it will receive all data sent by server.


Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>