- Trending Categories
Data Structure
Networking
RDBMS
Operating System
Java
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 add Label width in Tkinter?
A Label widget is used to display text and images in an application. The size of the label widget depends on a number of factors such as width, height, and Font-size of the Label text. The height and width define how the label widget should appear in the window.
To set the width of the label widget, we should declare the Label widget with a variable. Instantiating the label widget with a variable allows the users to add/edit the properties of the Label widget.
Example
# Import the required libraries from tkinter import * # Create an instance of tkinter frame or window win=Tk() # Set the size of the window win.geometry("700x350") # Add a Label widget label=Label(win, text="A Label widget is used to display text " "and images in an application.", font=('Times 14'), width=100) label.pack() win.mainloop()
Output
If you run the above code, it will display a window that contains a Label text with some width.
- Related Articles
- How to set the height/width of a Label widget in Tkinter?
- How to get the Tkinter Label text?
- How to justify text in label in tkinter in Python Need justify in tkinter?
- How to align text to the left in Tkinter Label?
- How to update a Python/tkinter label widget?
- How to add axis label to chart in Excel?
- How to create a hyperlink with a Label in Tkinter?
- How to display multiple lines of text in Tkinter Label?
- How to change Tkinter label text on button press?
- How to add an image in Tkinter?
- Underline Text in Tkinter Label widget
- Deleting a Label in Python Tkinter
- How to update the image of a Tkinter Label widget?
- How to change the color of a Tkinter label programmatically?
- How to Update the label of the Tkinter menubar item?

Advertisements