问题描述
我使用的是 Python 3.9.1 和 PyQt6。现在我想创建一个背景模糊的窗口,它应该如下所示:
模糊窗口背景演示
如果有人为此提供代码会很有帮助。
解决方法
真正的交易:
python -m pip install BlurWindow
import sys
from PySide2.QtWidgets import *
from PySide2.QtCore import *
from BlurWindow.blurWindow import blur
class MainWindow(QWidget):
def __init__(self):
super(MainWindow,self).__init__()
self.setAttribute(Qt.WA_TranslucentBackground)
self.resize(500,400)
blur(self.winId())
self.setStyleSheet("background-color: rgba(0,0)")
if __name__ == '__main__':
app = QApplication(sys.argv)
mw = MainWindow()
mw.show()
sys.exit(app.exec_())
,
取自 KDE Plasma,现在使用 Python 很容易做到这一点。
有关详细信息,请查看 - Watch this carefully
您将需要使用提供的名为 fluentapp 的库 -
For Project made with python - size 95 mb
您需要从项目中提取它并使用提供的参考指南。 我已经尝试过它很酷,并增强了您的应用程序的美感。
语法很简单,例如-
import fluentapp.pyqt6.windowtools as wingui
wingui.setWindowAlpha("0.5") # Make window transparent
wingui.addGaussianBlur(radius=20,cover= False)
#if you want to use additional layer for dark and light theme,you can set cover True for dark.
Your Code Here ----