GMgKe586q6suSQnyqZLlGCooeWM

Pages

Search

Wednesday, March 30, 2011

PyQt - QPushButton

import sys
from PyQt4 import QtGui, QtCore

app = QtGui.QApplication(sys.argv)
widget = QtGui.QWidget()

widget.setGeometry(200, 100, 400, 300)
widget.setWindowTitle('PyQt Application')

close = QtGui.QPushButton(QtGui.QIcon('lucia.png'), 'Close', widget)
close.setGeometry(10, 10, 100, 30)

def hello():
    print 'hello everybody'

widget.connect(close, QtCore.SIGNAL('clicked()'), hello)

widget.show()
sys.exit(app.exec_())



Share/Bookmark

1 comment:

  1. hi
    its a good example , can you please tell me how to increase the size of icon image it looks so much little on button

    ReplyDelete