- Trending Categories
- Data Structure
- Operating System
- C Programming
- 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 the size of text on a label in Tkinter?
The label widget in Tkinter is used to display text and images in a Tkinter application. In order to change the properties of the label widget such as its font-property, color, background color, foreground color, etc., you can use the configure() method.
If you want to change the size of the text in a Label widget, then you can configure the font=('font-family font-size style') property in the widget constructor.
# Import the required libraries from tkinter import * import tkinter.font as tkFont # Create an instance of tkinter frame or window win=Tk() # Set the size of the tkinter window win.geometry("700x350") def font_style(): label.config(font=('Helvetica bold', 26)) # Create a Label label = Label(win, text="Click the Button to Change the Font Style.", font=('Times', 24)) label.pack() b1 = Button(win, text="Change the Label Size", command=font_style) b1.pack() win.mainloop()
When you run the above code, it will display a window with a label widget and a button to change the font style of the label.
Now, click the "Change the Label Size" button and it will modify the font style of the label.
- How to change Tkinter label text on button press?
- Python Tkinter – How do I change the text size in a label widget?
- How to get the Tkinter Label text?
- How to change the color of a Tkinter label programmatically?
- How to align text to the left in Tkinter Label?
- How to display multiple lines of text in Tkinter Label?
- How to center a label in a frame of fixed size in Tkinter?
- Underline Text in Tkinter Label widget
- How to justify text in label in tkinter in Python Need justify in tkinter?
- How to set the font size of a Tkinter Canvas text item?
- How to change text cursor color in Tkinter?
- How to change the color of certain words in a Tkinter text widget?
- How to change the font size of Text using FabricJS?
- How to change the font and size of buttons and frame in tkinter?