from PyQt4 import QtCore QtGui connector QtCore QObject def connected_

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
from PyQt4 import QtCore, QtGui
connector = QtCore.QObject()
def connected_to(source, signature):
'''
'''
def connect(slot):
connector.connect(source, QtCore.SIGNAL(signature), slot)
return slot
#
return connect
app = QtGui.QApplication([])
timer = QtCore.QTimer()
timer.start(3000)
@connected_to(timer, 'timeout()')
def trigger():
print 'Hello and exit!'
app.exit()
print 'starting...'
app.exec_()