Feb-20-2021, 10:09 PM
(This post was last modified: Feb-20-2021, 10:32 PM by deanhystad.)
I think you are having a problem deleting your button because you don't have a handle to the button. You provide this example:
When you call Button() followed by .place() as in Button(root, text="OK"...).place(x=655, y=140) the thing returned is None. This is because the place() function returns none. I cannot tell you how many times I see this error in this forum. If you want to keep the a reference to the button, you need to split the creation and the place.
button_ok.destroy()And in an earlier example this:
Output:button_ok = Button(root, text="OK", width=7, pady=8, command=check_passcode, state=DISABLED).place(x=655, y=140)
Guess what, button_ok is None!When you call Button() followed by .place() as in Button(root, text="OK"...).place(x=655, y=140) the thing returned is None. This is because the place() function returns none. I cannot tell you how many times I see this error in this forum. If you want to keep the a reference to the button, you need to split the creation and the place.
button_ok = Button(root, text="OK", width=7, pady=8, command=check_passcode, state=DISABLED) button_ok.place(x=655, y=140)And to remove a button you should use forget_pack() to remove it from view, then you can use destroy() if you will never use it again, or keep it around and use pack or place or whatever to make it visiable.