Jul-04-2020, 09:15 AM
(This post was last modified: Jul-04-2020, 09:15 AM by Pedroski55.)
Thanks, but that is a bit of an overkill, wiped out all my other stuff!
I just want to delete label4 before I recreate it.
To do that, I think I need to get the ID of label4, which is an integer.
How can I get label4's ID?
Just guessing, I used ID = 4 for label4 the first time. That worked, the previous text was gone.
To begin with, I made label4, so that getInput() has something to delete:
But, the next time that ID did not work, because label4 was deleted. The new label4 probably has an ID that went up by 1.
How can I get the integer ID of label4 each time around?
I just want to delete label4 before I recreate it.
To do that, I think I need to get the ID of label4, which is an integer.
How can I get label4's ID?
Just guessing, I used ID = 4 for label4 the first time. That worked, the previous text was gone.
To begin with, I made label4, so that getInput() has something to delete:
label4 = tkinter.Label(frame, text= 'Your input will be here after you click the button.',font=('helvetica', 10, 'bold'), anchor='w', wraplength=390) canvas1.create_window(200, 250, window=label4)I put
canvas1.delete(4)in getInput() at the beginning. Sure enough, the text I put there in the beginning was gone.
But, the next time that ID did not work, because label4 was deleted. The new label4 probably has an ID that went up by 1.
How can I get the integer ID of label4 each time around?