아미(아름다운미소)

python PyQT 에서 이미지를 윈도우에 표시하는 방법 본문

랭귀지/PYTHON

python PyQT 에서 이미지를 윈도우에 표시하는 방법

유키공 2018. 12. 29. 16:03

How to display an image onto a PyQT window

QLabel은 setPixmap 메서드를 가지고 있기 때문에 이미지를 표시 할 수 있습니다.
예제)
lb = QtGui.QLabel(self)
pixmap = QtGui.QPixmap("{경로/파일}")
height_label = 100
lb.resize(self.width(), height_label)
lb.setPixmap(pixmap.scaled(lb.size(), QtCore.Qt.IgnoreAspectRatio))
self.show()  
Comments