Mahir Hami Abrar
Mahir Hami Abrar

Reputation: 73

Create a Transparent Blur Window

I am using Python 3.9.1 and PyQt6. Now I want to create a window with blurred background, which should look something like below:

Blurred Window Background Demo

It would be helpful if anybody provide me a code for this.

Upvotes: 5

Views: 4064

Answers (2)

Pedro
Pedro

Reputation: 380

the real deal:

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, 0, 0)")



if __name__ == '__main__':
    app = QApplication(sys.argv)
    mw = MainWindow()
    mw.show()
    sys.exit(app.exec_())

win11

Upvotes: 6

Akash Sharma
Akash Sharma

Reputation: 9

Well taken from KDE Plasma, its easy now to do this with Python.

For details, check this out - Watch this carefully

You will need to use the library provided called fluentapp -

For Project made with python - size 95 mb

You will need to extract it from the project and use the reference guide provided. I have already tried it its cool and enhances the beauty of your app.

Syntax is easy e.g. -

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 ---- 

Upvotes: 0

Related Questions