1from PyQt4 import QtGui, QtCore
2
3class Window(QtGui.QWidget):
4 def __init__(self):
5 QtGui.QWidget.__init__(self)
6 self.button = QtGui.QPushButton('', self)
7 self.button.clicked.connect(self.handleButton)
8 self.button.setIcon(QtGui.QIcon('myImage.jpg'))
9 self.button.setIconSize(QtCore.QSize(24,24))
10 layout = QtGui.QVBoxLayout(self)
11 layout.addWidget(self.button)
12
13 def handleButton(self):
14 pass
15
16
17if __name__ == '__main__':
18
19 import sys
20 app = QtGui.QApplication(sys.argv)
21 window = Window()
22 window.show()
23 sys.exit(app.exec_())
24