from PyQt5.QtWidgets import QWidget, QHBoxLayout, QLabel, QSizePolicy from PyQt5.QtGui import QPixmap class AboutWidget(QWidget): def __init__(self, typex="init"): super().__init__() self.base = QHBoxLayout() logo = QPixmap("resources/logo.png") logo_label = QLabel() logo_label.setPixmap(logo) logo_label.setScaledContents(True) # 自适应图片大小 logo_label.setFixedSize(int(logo_label.height() * 0.4), int(logo_label.height() * 0.4)) # logo_label.setFixedSize(50, 50) self.base.addWidget(logo_label) self.setLayout(self.base)