Good evening I would like you to help me put a blur effect in a window in pyqt the result that I hope is something like this:
this is the code:
import sys
from PyQt5.QtWidgets import QMainWindow,QApplication, QGraphicsEffect,QGraphicsDropShadowEffect
from PyQt5 import QtCore
from PyQt5 import QtGui
from PyQt5 import uic
class Principal(QMainWindow):
def __init__(self):
QMainWindow.__init__(self)
uic.loadUi("window.ui",self)
self.setWindowFlags(QtCore.Qt.FramelessWindowHint)
self.setAttribute(QtCore.Qt.WA_NoSystemBackground,True)
self.setAttribute(QtCore.Qt.WA_TranslucentBackground,True)
self.desenfoque = QGraphicsDropShadowEffect()
self.desenfoque.setBlurRadius(0.4)
self.setGraphicsEffect(self.desenfoque)
def paintEvent(self,event=None):
painter = QtGui.QPainter(self)
painter.setOpacity(0.7)
painter.setBrush(QtCore.Qt.white)
painter.setPen(QtGui.QPen(QtCore.Qt.white))
painter.drawRect(self.rect())
app = QApplication([])
p = Principal()
p.show()
app.exec_()