Qlab中的失真图像

2024-10-06 11:23:01 发布

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

我正在使用Qlabel(PyQt4)在我的应用程序中显示图像。当应用程序第一次渲染图像时,图像看起来失真了。但是第二次以后(在关闭窗口并重新打开后),图像显示没有失真。如何避免图像第一次显示时的失真?你知道吗

失真图像 enter image description here

无失真图像 enter image description here

代码段:

pixmap = QtGui.QPixmap(_fromUtf8(image))
scaledPixmap = pixmap.scaled(self.wCam0.ui.lblImage.size(), QtCore.Qt.IgnoreAspectRatio, QtCore.Qt.FastTransformation)
self.wCam0.ui.lblImage.setPixmap(scaledPixmap)

在上面的片段中,自身.wCam0.ui.L限制是Qlabel对象,image是需要显示的图像的位置/路径。你知道吗


Tags: 图像imageself应用程序ui代码段qtpyqt4