文章目录
- QLabel设置图片
QLabel设置图片
from PyQt5.QtWidgets import *
from PyQt5.QtGui import *
import sysapp = QApplication(sys.argv)window = QWidget()hbox = QHBoxLayout(window)# 设置标签图片
lable = QLabel()
lable.setPixmap(QPixmap('./img/window.png').scaled(100, 100))hbox.addWidget(lable)window.show()sys.exit(app.exec_())
运行结果: