QImage from PyQt5.QtCore import Qt app = QApplication([]) window = QWidget() layout = QVBoxLayout() label = QLabel() pixmap = QPixmap("path/to/your/image.png") # 确保路径正确 label.setPixmap(pixmap) label.setAlignment(Qt.AlignCenter) layout.addWidget(label) window.setLayout(layout) ...
<layout class="QVBoxLayout" name="verticalLayout"> <item> <widget class="QLabel" name="label_2"> <widget class="QLabel" name="welcomeLabel"> <property name="styleSheet"> <string notr="true">QLabel { font-style:italic; }</string> </property> <property name="text"> <string>Welcome...