Skip to content

Instantly share code, notes, and snippets.

@cosven
Created June 29, 2023 16:02
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save cosven/e73fb8bd310c8d83bd74fd1d527706f2 to your computer and use it in GitHub Desktop.
Save cosven/e73fb8bd310c8d83bd74fd1d527706f2 to your computer and use it in GitHub Desktop.
PyQt5 blur widget
class BlurWidget(QWidget):
def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)
effect = QGraphicsBlurEffect(self)
effect.setBlurRadius(120)
self.setGraphicsEffect(effect)
self.parent().installEventFilter(self)
def eventFilter(self, obj, e):
if obj == self.parent() and e.type() == QEvent.Resize:
self.resize(e.size().width()-e.size().height(), e.size().height())
return super().eventFilter(obj, e)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment