PyQt5 – Change the text font and size in Push button
In this article we will see how to change the text style or size of Push Button.
QPushButton is a simple button in PyQt, when clicked by a user some associated action gets performed. For adding this button into the application, QPushButton class is used.
In order to set font we will use setFont method which takes QFont object as argument.
Syntax : button.setFont(QFont(‘Arial’, 15))
Argument : It takes two argument first is font name and other is integer which refer to size of text.
Action performed It changes the size and font of text.
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