画像の表示

2014/12/10

Python2.7.6, pyQt4.11

# -*- coding: utf-8 -*-

import sys
from PyQt4 import QtGui

filepath = 'hogehoge.png'

def main():

    app = QtGui.QApplication(sys.argv)

    view = QtGui.QGraphicsView()
    scene = QtGui.QGraphicsScene()
    pixmap = QtGui.QPixmap(filepath)
    item = QtGui.QGraphicsPixmapItem(pixmap)
    scene .addItem(item)
    view.setScene(scene)
    view.show()

    sys.exit(app.exec_())

if __name__ == '__main__':
    main()


PyQtでイメージビューワ
http://melpystudio.blog82.fc2.com/blog-entry-138.html