PyqLabel 4图像大小调整

2024-10-03 21:34:40 发布

您现在位置:Python中文网/ 问答频道 /正文

我正在使用此功能(菜单按钮)打开图像:

def open_file(self, currView):
    fileName = QtGui.QFileDialog.getOpenFileName(self, "Open File", QtCore.QDir.currentPath())
    if fileName:
        pixelMap = QtGui.QPixmap(fixPgmPixmap(fileName,tmpPngFilename))
        if pixelMap.isNull():
                QtGui.QMessageBox.information(self, "Image Viewer", "Cannot load %s." % fileName)
                return
        currView.setPixmap(pixelMap)
        currView.show()

currView要么是leftImage,要么是RightImage——它们都是qlabel。在

图像加载后,我想重新缩放(放大\缩小)。在

但是我在Qlabel上没有成功,我需要在像素地图上做吗?(如果是,那怎么办?)在


Tags: 图像self功能ifdef菜单openfilename