- 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 justify text in label in tkinter in Python Need justify in tkinter?
Tkinter Label widgets are used to add images and create text in a particular application. There are various functions and methods available in the library which can be used to style the widgets and its property. In order to justify the text in the label widget, we can use the justify property. It is generally used to justify the position or the alignment of the text such as RIGHT, LEFT, and CENTER.
In this application, we will justify the position of a text label using the justify property.
#Import tkinter library from tkinter import * #Create an instance of tkinter frame or window win= Tk() #Set the geometry of tkinter frame win.geometry("750x350") #Crate a Label widget label1= Label(win, text="Box1") label1.pack() label2= Label(win, text= "\nKeep\nLearning", bd=1, relief= "solid",font= ("Helvetica 20"), justify= RIGHT) label2.pack() Label(win, text= "Box2").pack() label3= Label(win, text="\nLearning\nMakes\nPerfect", bd=1, relief="solid", font=('Helvetica 20'), justify= LEFT) label3.pack() win.mainloop()
Running the above code will display a window that contains a label widget with some text. The visual alignment of the text can be defined by the justify property.
- Underline Text in Tkinter Label widget
- How to align text to the left in Tkinter Label?
- How to display multiple lines of text in Tkinter Label?
- How to get the Tkinter Label text?
- Deleting a Label in Python Tkinter
- Python Tkinter – How do I change the text size in a label widget?
- How to change the size of text on a label in Tkinter?
- How to Justify Text using text-align & text-justify CSS Properties?
- How to change Tkinter label text on button press?
- How to add Label width in Tkinter?
- How to Justify Text in TextView in Android?
- Changing Tkinter Label Text Dynamically using Label.configure()
- How to Justify Text in TextView on Android?
- text-justify Property in CSS
- How to word-wrap text in Tkinter Text?