ASPN ActiveState Programmer Network
ActiveState
/ Home / Perl / PHP / Python / Tcl / XSLT /
/ Safari / My ASPN /
Cookbooks | Documentation | Mailing Lists | Modules | News Feeds | Products | User Groups


Recent Messages
List Archives
About the List
List Leaders
Subscription Options

View Subscriptions
Help

View by Topic
ActiveState
.NET Framework
Open Source
Perl
PHP
Python
Tcl
Web Services
XML & XSLT

View by Category
Database
General
SOAP
System Administration
Tools
User Interfaces
Web Programming
XML Programming


MyASPN >> Mail Archive >> python-list
python-list
Re: PyQt processEvents not processing
by DarkBlue other posts by this author
Nov 7 2009 6:25PM messages near this date
Re: Cancelling a python thread (revisited...) | How convert string '1e7' to an integer?
On Nov 8, 12:04 am, David Boddie <da...@[...].uk>  wrote:
>  On Saturday 07 November 2009 05:12, DarkBlue wrote:
> 
> 
> 
>  > qt 4.5.3
>  > pyqt 4.6.1
>  > python 2.6
> 
>  > I have this QtTable widget which I want to refresh once about every 2
>  > seconds with new data.
> 
>  > so I do :
> 
>  >  def updateSchedule(self):
>  >          for j in range(0,10):
>  >                       doUpdate()
>  >                       QtCore.processEvents()
>  >                       sleep(2)
> 
>  >  unfortunately QT appears to wait until the for loop finishes
>  >  and only then paints the QtTable widget on the screen showing
>  >  only the latest updated result.
> 
>  It's difficult to know exactly why this is without more context. Calling
>  the application's processEvents() method should give the user interface the
>  chance to update itself, but perhaps you need to explicitly call update()
>  on the QTableView or QTableWidget instance to ensure that it is refreshed.
> 
>  An alternative way to do this is to use a timer to update the table every
>  two seconds.
> 
>  David


As per your suggestion I added a timer to the init part and now the
update works as expected , even without calls to processEvents.

self.myTimer = QtCore.QTimer(self)
QtCore.QObject.connect(self.myTimer,QtCore.SIGNAL("timeout()"),
self.doUpdate)
self.timerTime = 0
self.myTimer.start(2000)

Thanks
Db
-- 
http://mail.python.org/mailman/listinfo/python-list

Privacy Policy | Email Opt-out | Feedback | Syndication
© ActiveState Software Inc. All rights reserved