Created
June 29, 2023 16:02
-
-
Save cosven/e73fb8bd310c8d83bd74fd1d527706f2 to your computer and use it in GitHub Desktop.
PyQt5 blur widget
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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