def __init__(self, parent=None): QLCDNumber.__init__(self, parent) self.segmentStyle = QLCDNumber.Filled timer = QTimer(self) timer.connect('timeout()', self.showTime); timer.start(1000) self.showTime() self.windowTitle = tr('Digital Clock') self.resize(150, 60)
from Qt.Core import QObject, QTimer, QCoreApplication count = 0 def timeout(): global count count += 1 print 'timeout %d'%count if count > 5: QCoreApplication.quit() app = QCoreApplication('timer') timer = QTimer(None) timer.interval = 1000 timer.connect('timeout()', timeout) timer.start() app.run()
def __init__(self, parent=None): QTimer.__init__(self, parent) Qt._addDynamicMethod('clicked(bool)',self, self.clicked)