PyQt5基础学习-self.setWindowFlags(设置界面的边框, 样式) 1.self.setStyleSheet(设置QSS语言)
设置边框的样式,如去除边框, 设置窗口在最前端等
WindwoPattern.py
""" 设置窗口边框, 样式和插入背景图片 """ from PyQt5.QtCore import * import sys from PyQt5.QtWidgets import * class WindowPattern(QMainWindow): def __init__(self): super(WindowPattern, self).__init__() self.resize(500, 260) #Qt.FramelessWindowHint(去除边框) # self.setWindowFlags(Qt.FramelessWindowHint | Qt.WindowStaysOnTopHint) #设置窗口的名字 self.setObjectName("MainWindow") #设置窗口的图片 self.setStyleSheet("#MainWindow{border-image:url(../picture/F6fhJr.jpg);}") if __name__ == "__main__": app = QApplication(sys.argv) main = WindowPattern() main.show() sys.exit(app.exec_())
每天更新pyQt5内容