On 28.01.08 09:58:20, P. Mathé wrote: > Thank you Scott for your answer, but unnless I didn'y understand you > correctly, it does not work : the timer singleshot is fired only after the > loop ends.
Unfortunately you didn't understand correctly. What Scott meant was that the slot connected to the singleshot should download the stuff with urllib, then update the listwidget and then return control to the event loop (and if jours is not empty schedule another singleshot timer). Something like this should work: class radioProgDialog(QDialog, radioUi): def __init__(self): QDialog.__init__(self) # Set up the user interface self.setupUi(self) self.connect(self.btnGo,SIGNAL("clicked()"),self.extraire) # def updateGui(self): d=self.d jour = self.jours.last() self.jours.removeAll( jour ) next_url=url % jour p=urllib.urlopen(next_url).read() self.d=DateFromTicks(jour) logText=u'téléchargement %02d/%02d/%d' % (d.day,d.month,d.year) self.log.insertItem(0, QListWidgetItem(logText)) self.progressBar.setValue(self.progressBar.value() + 1) print logText if( self.jours.isEmpty() ): QTimer.singleShot(0, self.updateGui) def extraire(self): self.url='http://www.radiofrance.fr/francevivace/prog/index.php?time=%u' # self.jours=[(int((now() + (j * oneDay)).ticks())) for j in range(0, 4)] self.progressBar.setMaximum(len(jours)) self.progressBar.setValue(0) print 'maxi', self.progressBar.maximum() QTimer.singleShot(0, self.updateGui) print 'fini Vivace' Andreas -- Tomorrow will be cancelled due to lack of interest. _______________________________________________ PyQt mailing list PyQt@riverbankcomputing.com http://www.riverbankcomputing.com/mailman/listinfo/pyqt