Python 如何在PyQT中更改QGraphicsView中的图像?

Python 如何在PyQT中更改QGraphicsView中的图像?,python,user-interface,pyqt,pyqt4,Python,User Interface,Pyqt,Pyqt4,我能够在表单加载时最初显示图像。以后如何使用其他类更改图像 主要类别: self.scene = QtGui.QGraphicsScene() self.graphicsView = QtGui.QGraphicsView(Form) self.graphicsView.setGeometry(QtCore.QRect(10, 280, 681, 331)) self.graphicsView.setObjectName(_fromUtf8("graphicsView")) self.scene

我能够在表单加载时最初显示图像。以后如何使用其他类更改图像

主要类别:

self.scene = QtGui.QGraphicsScene()
self.graphicsView = QtGui.QGraphicsView(Form)
self.graphicsView.setGeometry(QtCore.QRect(10, 280, 681, 331))
self.graphicsView.setObjectName(_fromUtf8("graphicsView"))
self.scene.addPixmap(QtGui.QPixmap(search_result)) 
self.graphicsView.setScene(ui.scene)
另一类:

ui.graphicsView.resetCachedContent()
ui.scene.addPixmap(QtGui.QPixmap('path to another file')) 
ui.graphicsView.setScene(ui.scene)

无法在QGraphicsView中显示jpg图像。 使用QLabel显示jpg图像