Reputation: 2842
-EDITED
Im using this code to load a picture in a qlabel found in zetcode. Its working in later version of pyqt4, But not in pyqt4 4.9. Is there a change in using qpixmap in pyqt4 4.9? Thanks.
import sys
from PyQt4 import QtGui, QtCore
class Example(QtGui.QWidget):
def __init__(self):
super(Example, self).__init__()
self.initUI()
def initUI(self):
hbox = QtGui.QHBoxLayout(self)
pixmap = QtGui.QPixmap("redrock.png")
lbl = QtGui.QLabel(self)
lbl.setPixmap(pixmap)
hbox.addWidget(lbl)
self.setLayout(hbox)
self.move(300, 200)
self.setWindowTitle('Red Rock')
self.show()
def main():
app = QtGui.QApplication(sys.argv)
ex = Example()
sys.exit(app.exec_())
if __name__ == '__main__':
main()
Upvotes: 1
Views: 2134
Reputation: 13699
I am using the same version as you and for this example to work you script must be in the same directory as redrock.png
Upvotes: 1