标签:jpg elf port == round style sys img __name__
效果图:
play.py
#!/usr/bin/env python # _*_ coding: UTF-8 _*_ """================================================= @Project -> File : Operate_system_ModeView_structure -> play.py @IDE : PyCharm @Author : zihan @Date : 2020/5/4 11:16 @Desc : =================================================""" import sys from PyQt5.QtWidgets import QApplication, QWidget from PyQt5.QtGui import QPainter, QPixmap from ui_play import Ui_Form class QmyWidget(QWidget): def __init__(self, parent=None): super().__init__(parent) # 调用父类构造函数 self.ui = Ui_Form() # 创建UI对象 self.ui.setupUi(self) # 构造UI def paintEvent(self, event): # 绘制窗体背景图片 painter = QPainter(self) pic = QPixmap("background.jpg") painter.drawPixmap(0, 0, self.width(), self.height(), pic) super().paintEvent(event) if __name__ == ‘__main__‘: app = QApplication(sys.argv) # 创建app form = QmyWidget() form.show() sys.exit(app.exec_())
窗体部分就自己随便画一个窗体,图片用自己喜欢的就行。
标签:jpg elf port == round style sys img __name__
原文地址:https://www.cnblogs.com/smart-zihan/p/12826504.html