[PyKDE] Some fundamentals
Phil Thompson
phil at river-bank.demon.co.uk
Tue Feb 25 12:11:00 GMT 2003
On Tuesday 25 February 2003 10:55 am, Tom Chance wrote:
> Well thank you to all who replied - that's much clearer now. By the time
> I'm finished with Python, I sweat I'm going to be half-way towards knowing
> C/C++ as well, as so many docs (even the O'Reilly books) seem to assume
> you're coming from it, and explain everything in terms of it! Anyway, I
> understand that all now, and I've worked out how to use it which is the
> important thing :)
>
> There's one other thing that has puzzled me lately, and I can only assume
> that it's either a misunderstanding or a bug on my part. I've got some code
> which, on the push of a button, scans the DVD device, then populates the
> ListView with items for each track. Currently, the code works like so:
>
> ----
> print "Scanning DVD"
>
> (popen command to get number of tracks)
> for i in range(numtracks):
> (popen command to get track info)
> print (info about track)
> (add ListViewItem)
>
> print "Finished"
> ----
>
> Now I would expect that the ListViewItems would appear one by one as the
> for loop scans each track. But what happens is that it prints out the info
> for each track as it goes along, but only populates the ListView with the
> items when it's done. Why is this?
The screen gets updated when you return to the Qt event loop. Have a look at
QApplication.processEvents().
Phil
More information about the PyQt
mailing list