- Trending Categories
- Data Structure
- Operating System
- C Programming
- 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 align text to the left in Tkinter Label?
Tkinter Label widget can be aligned using the anchor attributes. In order to calculate the accommodate spacing and alignment of the widget, anchor would help in a better way. Anchor provides several options such as N, W, S, E, NW, NE. SW, SE which can be defined in the pack manager itself.
In the following example, we will align the Label text of an application to the left by adding the anchor attribute towards “w” direction.
#Import the required library from tkinter import* #Create an instance of tkinter frame win= Tk() #Set the geometry win.geometry("750x250") #Create a Label Widget Label(win, text= "New Line Text", font= ('Helvetica 15 underline'), background="gray74").pack(pady=20, side= TOP, anchor="w") win.mainloop()
Running the above code will align the text label widget towards Left direction.
- How to get the Tkinter Label text?
- How to change Tkinter label text on button press?
- Underline Text in Tkinter Label widget
- How to display multiple lines of text in Tkinter Label?
- How to change the size of text on a label in Tkinter?
- How to justify text in label in tkinter in Python Need justify in tkinter?
- How to align checkbutton in ttk to the left side?
- Changing Tkinter Label Text Dynamically using Label.configure()
- How to align axis label to the right or top in Matplotlib?
- How to add Label width in Tkinter?
- How to Update the label of the Tkinter menubar item?
- How to align text to the right in ttk Treeview widget?
- Python Tkinter – How do I change the text size in a label widget?
- How to word-wrap text in Tkinter Text?
- How to wrap the text of a label in JavaFX?