Skip to content

Instantly share code, notes, and snippets.

@arkottke
Created August 16, 2012 15:36
Show Gist options
  • Save arkottke/3371142 to your computer and use it in GitHub Desktop.
Save arkottke/3371142 to your computer and use it in GitHub Desktop.
#!/usr/bin/env python
import glob
import sys
from PySide import QtGui, QtCore
class MainWindow(QtGui.QMainWindow):
def __init__(self):
super(MainWindow, self).__init__()
self.scene = QtGui.QGraphicsScene()
layout = QtGui.QGraphicsLinearLayout()
for f in glob.glob('./test/*.JPG'):
pixmap = QtGui.QPixmap(f).scaledToHeight(200)
pixmapItem = self.scene.addPixmap(pixmap)
widget = QtGui.QGraphicsWidget(pixmapItem)
layout.addItem(widget)
form = QtGui.QGraphicsWidget()
form.setLayout(layout)
self.scene.addItem(form)
view = QtGui.QGraphicsView()
view.setScene(self.scene)
self.setCentralWidget(view)
app = QtGui.QApplication(sys.argv)
mw = MainWindow()
mw.show()
sys.exit(app.exec_())
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment