PyQt5 QLabel – Checking if the blur effect is widget type

In this article we will see how we can check if the blur effect of the label is widget type or not. Widget type allows user to know if blur effect object is widget type just like label, buttons etc or not.

In order to check the blur effect is widget type or not we use isWidgetType method.

Syntax : blur_effect.isWidgetType()

Argument : It takes no argument

Return : It returns bool

Below is the implementation





# importing libraries
from PyQt5.QtWidgets import * 
from PyQt5 import QtCore, QtGui
from PyQt5.QtGui import * 
from PyQt5.QtCore import * 
import sys
class Window(QMainWindow):
    def __init__(self):
        # setting title
        self.setWindowTitle("Python ")
        # setting geometry
        self.setGeometry(100, 100, 600, 400)
        # calling method
        # showing all the widgets
    # method for widgets
    def UiComponents(self):
        # creating label
        label = QLabel("Label", self)
        # setting geometry to the label
        label.setGeometry(200, 100, 150, 60)
        # setting alignment to the label
        # setting font
        label.setFont(QFont('Arial', 15))
        # setting style sheet of the label
                            "border : 2px solid green;"
                            "background : lightgreen;"
        # creating a blur effect
        self.blur_effect = QGraphicsBlurEffect()
        # setting blur radius
        # adding blur effect to the label
        # creating a result label
        result = QLabel(self)
        # setting geometry to the result
        result.setGeometry(200, 200, 300, 30)
        # checking if blur effect is widget type
        check = self.blur_effect.isWidgetType()
        # setting text to the result
        result.setText("Widget type ? : " + str(check))
# create pyqt5 app
App = QApplication(sys.argv)
# create the instance of our Window
window = Window()
# start the app


Output :

Attention geek! Strengthen your foundations with the Python Programming Foundation Course and learn the basics.

To begin with, your interview preparations Enhance your Data Structures concepts with the Python DS Course.

My Personal Notes arrow_drop_up

Check out this Author's contributed articles.

If you like GeeksforGeeks and would like to contribute, you can also write an article using or mail your article to See your article appearing on the GeeksforGeeks main page and help other Geeks.

Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.