Python PyQt4 update data on widget every 1 min -


i have pyqt4 application reads information local sqlite3 database , display data using qtablewidget.

the data stored on sqlite3 changes time time.so, want update table widget once every 1 min.

to simplify matters, let's assume have function called 'refresh()' refresh contents in table widget.

how make function 'refresh()' execute every 1 min? have done in tkinter using time.after(). have no idea how in pyqt.

your function should called paintevent. make qtimer so:

self.timer = qtcore.qtimer() self.timer.timeout.connect(self.update) self.timer.start(60000) #trigger every minute. 

that unless need reason update in backed , not in front end (in other words function not used drawing. otherwise should allmost without question called paintevent). do:

self.timer.timeout.connect(self.refresh) 

Comments

Popular posts from this blog

java - WrongTypeOfReturnValue exception thrown when unit testing using mockito -

php - Magento - Deleted Base url key -

android - How to disable Button if EditText is empty ? -