PyQt实现跨平台毛玻璃背景(全网首发)
找了很久,大部分都需要调用 win32 API 无法跨平台,终于找到啦 项目地址
安装:
python -m pip install BlurWindow
简单例子
import sys from PySide2.QtWidgets import * from PySide2.QtCore import * from BlurWindow.blurWindow import GlobalBlur class MainWindow(QWidget): def __init__(self): super(MainWindow, self).__init__() self.setAttribute(Qt.WA_TranslucentBackground) self.resize(500, 400) GlobalBlur(self.winId(),Dark=True,QWidget=self) self.setStyleSheet("background-color: rgba(0, 0, 0, 0)") if __name__ == '__main__': app = QApplication(sys.argv) mw = MainWindow() mw.show() sys.exit(app.exec_())