Python Programming
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me

The Shed is going Social! Join us on FaceBook and Twitter and chime in on the conversation.

Go Back   Dev Shed ForumsProgramming LanguagesPython Programming

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old February 24th, 2003, 10:32 AM
telex4's Avatar
telex4 telex4 is offline
Wacky hack
Dev Shed Novice (500 - 999 posts)
 
Join Date: Apr 2001
Location: London, England
Posts: 513 telex4 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 1 h 38 m 37 sec
Reputation Power: 13
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?

[php]
Pseudo-Code:

print "Scanning DVD..."

for i in numtracks:
popen scanning programs, chop out info

item = QListViewItem(self.dvdTracks,None)
item.setText(0,title_label)
item.setText(1,self.tr(time_label))
print "Track %s: %s" % (i, time_label)

print "Finished"
[php]

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 10:59 AM.

Reply With Quote
  #2  
Old September 1st, 2003, 01:37 AM
nouse66 nouse66 is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Sep 2003
Posts: 2 nouse66 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Send a message via AIM to nouse66 Send a message via Yahoo to nouse66
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.

Reply With Quote
  #3  
Old September 1st, 2003, 05:03 AM
telex4's Avatar
telex4 telex4 is offline
Wacky hack
Dev Shed Novice (500 - 999 posts)
 
Join Date: Apr 2001
Location: London, England
Posts: 513 telex4 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 1 h 38 m 37 sec
Reputation Power: 13
Yes, you need to do this:

app.processEvents()

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

Reply With Quote
  #4  
Old September 1st, 2003, 01:19 PM
nouse66 nouse66 is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Sep 2003
Posts: 2 nouse66 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Send a message via AIM to nouse66 Send a message via Yahoo to nouse66
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...

Reply With Quote
Reply

Viewing: Dev Shed ForumsProgramming LanguagesPython Programming > PyQT/gui programming prob with updating widgets

Developer Shed Advertisers and Affiliates



Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump

Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 


Powered by: vBulletin Version 3.0.5
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.

© 2003-2013 by Developer Shed. All rights reserved. DS Cluster - Follow our Sitemap