I am new to pyside and I am following a tutorial at http://zetcode.com/gui/pysidetutorial/widgets2/. I am trying to get an image to show in a window. It seems that I should be able to pass in a file location for a picture on my computer, but no matter what I do I can't seem to get it to display the file I pass in. Any help would be greatly appreciated. Thanks!
import sys
from PySide 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("C://Users//Public//Pictures//Sample Pictures//Desert.jpg")
lbl = QtGui.QLabel(self)
lbl.setPixmap(pixmap)
hbox.addWidget(lbl)
self.setLayout(hbox)
self.setGeometry(300, 300, 280, 170)
self.setWindowTitle('Red Rock')
self.show()
def main():
app = QtGui.QApplication(sys.argv)
ex = Example()
sys.exit(app.exec_())
if __name__ == '__main__':
main()