PyQt4 单击事件

>>> from PyQt4 import QtGui
>>> import sys
>>> app = QtGui.QApplication(sys.argv)
>>> button = QtGui.QPushButton("Click me")
>>> button.move(QtGui.QCursor.pos())
>>> button.show()
>>> button.raise_()
>>> def hello():
...     print "hello"
...
>>> hello()
hello
>>> button.clicked.connect(hello)
>>> hello
hello
hello
hello
hello
hello
hello
hello
hello
button.clicked.disconnect(hello)
>>>

你可能感兴趣的:(python,PyQt)