I'm trying to change the value of the text of a label in tkinter, I'm using label.config()
but it seems that the previous value still appears on the screen with the new value.
This is the code that I'm using:
This is the result, the previous and the new text are together:
Whenever select_description()
is executed, new label is created and put in same cell. That is why there are overlapped text.
You need to create the label once outside the function:
description_label = Label(frame1)
description_label.grid(row=4, column=0, columnspan=4)
def select_description(event):
choice = list_profiles.get(ANCHOR)
if choice == 1:
description_label.config(text=...)
elif choice == 2:
description_label.config(text=...)
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.