February 24th, 2003, 11:32 AM
PyQT/gui programming prob with updating widgets
I've just started working with PyQt, which is so much nicer to work with than Tk, especially with Qt designer But these questions might also be answered by PyTk people, as it's probably a general GUI toolkit problem, not PyQt specific (hmmm).
Anyway, I've got a few questions:
1. I've got a function which scans the DVD drive with a seperate process for each track, getting length and chapter information. After each track is scanned, it prints out the results to the shell and puts the result into a QListView. The odd thing is that it prints the text out as it goes along, but only updates the QListView at the end. How can I make it so entries are put into QListView as it goes along?
print "Scanning DVD..."
for i in numtracks:
popen scanning programs, chop out info
item = QListViewItem(self.dvdTracks,None)
print "Track %s: %s" % (i, time_label)
And related to this is that I'd like to change the text on the button that is connected to the function when the function stars and ends, so while it's scanning, the button reads "Scanning...", and then is set back. Again, what seems to happen is that it only changes the button text when it reaches the end of the function.
Any hints/answers are most welcome
Last edited by telex4; February 24th, 2003 at 11:59 AM.
September 1st, 2003, 02:37 AM
Did you ever figure out how to do that?
I'm trying to pipe the output of a shell command to a QTextEdit to show the output in real time and I can't figure out a good way of doing it.
September 1st, 2003, 06:03 AM
Yes, you need to do this:
Where app is the application object you created from QApplication
Call that in the loop in which you process the data from the pipe and the GUI will update itself in the loop
September 1st, 2003, 02:19 PM
thanks, i'll give that a try. i wasnt actually processing the output and therefore i have no loop but i'll try to make something up...