I'd like to have a label in my GUI where text is left aligned. I tryied to use anchor
but it doesn't seem to work, if the string consists of multiple lines.
My code looks as follows:
lbl_welcome = tk.Label(fr_welcome, anchor = 'w', text = "First line\n and this is the second")
The label and frame are positioned to the north west, using sticky
.
What I get looks like this:
GUI with the label
Here the label/textbox is aligned to the left, but not the text itself. It works fine however with a single-line string, where \n
is not present.
By default each line is centered. You need to use the justify
option if you want the text left-justified.
lbl_welcome = tk.Label(..., justify="left")