How do I use Tkinter in Python to create line-wrapped text that fills the width of the window?

The Tkinter label widget does wrap. It is just that the default setting is no wrapping. To get the text on a label to wrap set the "wraplength" parameter, the units for this are screen units so try wraplength=50 and adjust as necessary. You will also need to set "justify" to LEFT, RIGHT or CENTER. Hope that helps.


welcomenote = Label(root, text="Your long text", font="helvetica 14", 
wraplength=300, justify="center")
welcomenote.pack()

Try the following:

tk.Label(root, textvariable=text, wraplength=500).pack()

Here 500 is the amount of pixels before the characters are put to the next line.

Tags:

Python

Tkinter