In this article we will see how to add icon to a push button. Here, setting icon not like setting an background image, it is similar to the icon of main window. Icon of button appear at the left side and text is on right size.
Below is the representation of pus button without and with icon.
In order to do this we will use
Syntax : button.setIcon(QIcon(‘logo.png’))
Argument : It takes file name if in same folder else file path
Action performed : It sets icon 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