In this article we will see how we can add shadow to the label by default there is no shadow to the label although we can create shadow to the label, below is the representation of how label with shadow box looks like
In order to do this we have to do the following –
1. Create a label
2. Set geometry to the label
3. Create a QGraphicsDropShadowEffect object
4. Set blur radius to the object(optional)
5. Add this object to the label with the help of setGraphicsEffect method
# creating a QGraphicsDropShadowEffect object shadow = QGraphicsDropShadowEffect() # setting blur radius (optional step) shadow.setBlurRadius(15) # adding shadow to the label label.setGraphicsEffect(shadow)
Below is the implementation
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.