In this article we will see how to create a button with image. Unlike icon which exist only at the left side, we will create a button which is covered with the image. In order to do so we will use
setStyleSheet method to add image to background of the button.
Below is how normal button and a button with image looks like.
Syntax : button.setStyleSheet(“background-image : url(image.png);”)
Argument : It takes string as argument.
Action performed : It sets background image to the button.
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. And to begin with your Machine Learning Journey, join the Machine Learning – Basic Level Course