- 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 set the height/width of a Label widget in Tkinter?
The Label widgets are used for displaying text and images in the 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 height and 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="How to set the height/width " "of a Label widget in Tkinter?", font=('Times 14'), width=60, height=15) label.pack() win.mainloop()
Output
Running the above code will display a window that contains a label widget within width and height.
- Related Articles
- How to set the width of a Tkinter Entry widget in pixels?
- How to update the image of a Tkinter Label widget?
- How to update a Python/tkinter label widget?
- How to get the width of the Tkinter widget?
- How to add Label width in Tkinter?
- How to set the min and max height or width of a Frame in Tkinter?
- Underline Text in Tkinter Label widget
- How to set focus for Tkinter widget?
- How to set the font size of Entry widget in Tkinter?
- Python Tkinter – How do I change the text size in a label widget?
- How to set a widget's size in Tkinter?
- How to set focus on Entry widget in Tkinter?
- How to set default text for a Tkinter Entry widget?
- How do I get the width and height of a Tkinter window?
- How to set viewport height and width in CSS

Advertisements