Display a label

    lbl_label1 = Label(root, text = "My text")
    lbl_label1.place(x=5, y=370)
Setting properties
//Background
    lbl_label1 = Label(root, text = "My text", bg="white")
//Border
    borderwidth=2, relief="groove"
//Width
    width=20,
//Font
    font=('', 18, 'bold')    #'normal', 'bold', etc

//Using multiple lines to make code easy to read
    lbl_label1 = Label(root,
                       text = "My text",
                       font=('', 18, 'bold'))    #'normal', 'bold', etc
    lbl_label1.place(x=5, y=370)
Update label text
#Make it global
    global lbl_label1

    lbl_label1.configure(text = "New text")

Multi line

Just use the \n newline character.
You’ll need to set anchor and justify if you want the text aligned left (defaults to center).

Align

lbl_my_label = Label(root, text = "My text", anchor="nw", justify="left")

anchor – Values n, ne, e, se, s, sw, w, nw, or center. For example, nw means display the information such that its top-left corner is at the top-left corner of the widget.

justify – When there are multiple lines of text displayed, one of left, center, or right.

Feel free to comment if you can add help to this page or point out issues and solutions you have found. I do not provide support on this site, if you need help with a problem head over to stack overflow.

Comments

Your email address will not be published. Required fields are marked *