Sunday, December 7, 2014

PyQt (2): QPushButton

QPushButton is a widget using to create a button.

Example:
from PyQt4 import QtGui
# create a button
btn = QtGui.QPushButton('Button')

# create button click function
def clickFunc():
    print 'This is a button!'

# create signal for the button
# when click the button, excute the click function
btn.clicked.connect(clickFunc)

# show the button ui
btn.show()

No comments:

Post a Comment