user13502078
user13502078

Reputation:

Tkinter: How to print text into a Label?

I have something like an e-mail storage and I want that the saved information printed out in my Label, but I want that the information stacked among each other.

This is my code, but when I enter another e-mail and password, the current Label text is replaced.

How can I fix that?

def print_data(mail,passwort):
    label_list["text"] = str(mail)+" | "+str(passwort)

def save_info():
    mail = entry_mail.get()
    passwort = entry_passwort.get()
    entry_mail.delete(0, tk.END)
    entry_passwort.delete(0, tk.END)
    print_data(mail,passwort)

Upvotes: 0

Views: 189

Answers (1)

ihsan
ihsan

Reputation: 375

you have to store the previous information in a variable. Then use:

label.configure(text= "previous label" + "new text")

Upvotes: 1

Related Questions