Search code examples
pythonpyqtpyside6pyqt6

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.


Solution

  • 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