- Trending Categories
Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
Physics
Chemistry
Biology
Mathematics
English
Economics
Psychology
Social Studies
Fashion Studies
Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
How to change a Tkinter widget's font style without knowing the widget's font family/size?
Tkinter’s widgets support properties and attributes such as font-family and font size which can be specified using the font(‘Font-Family’, font-size) property.
Example
In the following example, we have created a text label that can be configured by defining the font-family as “Times New Roman” and the font-size as “20”.
#Import the tkinter library from tkinter import * #Create an instance of tkinter frame win = Tk() #Set the geometry win.geometry("650x250") #Add a text label and add the font property to it label= Label(win, text= "This is a New Text", font=('Times New Roman bold',20)) label.pack(padx=10, pady=10) win.mainloop()
Output
Running the above code will display a window or frame with text,
- Related Articles
- How can I change the font family and font size with jQuery?
- How to change the font and size of buttons and frame in tkinter?
- How to change the font family of IText using FabricJS?
- How to change the font family of Text using FabricJS?
- How to change font Family of textView In Android?
- How to change the font size using CSS?
- How to change font size in HTML?
- How to change font size in ttk.Button?
- How to change the font on ttk.Entry in Tkinter?
- How to change the font style of a Textbox using FabricJS?
- How to change the font style of IText using FabricJS?
- How to change the font style of Text using FabricJS?
- How to set the font size of a Tkinter Canvas text item?
- How to change the font size of a text using JavaScript?
- How to change the font size of a Textbox using FabricJS?

Advertisements