On Tue, 9 Jul 2013 15:00:25 -0600 (MDT), Brian McDonald wrote:

Just getting into programming in general. Loving python so far. I am
working on an application that will display database information on
screen. The idea is that some rows of database information will appear on
screen for 30 seconds, and then the next rows will appear. I think I have
made some pretty good headway getting the database connected and even
displaying data, but I am having a hell of a time getting the data to
refresh to a new query after 30 seconds. I feel like I must just be
calling the qtimer at the wrong point in the program. Or, perhaps I should
be using a "while" loop of some kind. Anyway, here is my code. Any help
would be sooo appreciated.

Just quickly glancing at the code, I notice that you start the timer after
the application has run. Have you tried starting the timer in your run()
method?

Also, you can't connect the timer signal in the way that you hope, you need to do something like:

(in timer)
self.newQuery = newQuery
self.timer.timeout.connect(self.createQuery)

(in createQuery)
self.query=QtSql.QSqlQuery(self.newQuery)

Or:
(in timer)
self.timer.timeout.connect(lambda: self.createQuery(newQuery))

-Hazen

_______________________________________________
PyQt mailing list    PyQt@riverbankcomputing.com
http://www.riverbankcomputing.com/mailman/listinfo/pyqt

Reply via email to