#coding=utf-
import sys
from PyQt5.QtCore import Qt
from PyQt5.QtWidgets import QWidget, QApplication
from PyQt5.QtGui import QPixmap, QPainter, QBitmap, QCursor
import PyQt5.QtCore as QtCore class PixWindow(QWidget): # 不规则窗体
def __init__(self):
super().__init__()
self.pix = QPixmap('0.png') # 蒙版
windowWidth =
windowHeight =
self.resize(windowWidth, windowHeight)
self.pix = self.pix.scaled(int(windowWidth), int(windowHeight))
self.setMask(self.pix.mask())
self.setWindowFlags(Qt.FramelessWindowHint | QtCore.Qt.WindowStaysOnTopHint) # 设置无边框和置顶窗口样式 def paintEvent(self, event): # 绘制窗口
paint = QPainter(self)
paint.drawPixmap(, , self.pix.width(), self.pix.height(), self.pix) if __name__ == '__main__':
app = QApplication(sys.argv)
win = PixWindow()
win.show()
sys.exit(app.exec_())