pyqt5 QGraphicsView 显示图片

from PyQt5.QtGui import QImage, QPixmap
from PyQt5.QtWidgets import QGraphicsPixmapItem, QGraphicsScene

def showImage(self):

    frame = QImage("img/entrance1.png")
    pix = QPixmap.fromImage(frame)
    item = QGraphicsPixmapItem(pix)
    scene = QGraphicsScene()
    scene.addItem(item)
    self.graphicsView.setScene(scene)

你可能感兴趣的:(python,qt,pyqt5)