Python Forum
tkinter -- after() method and return from function -- (python 3)
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
tkinter -- after() method and return from function -- (python 3)
If I needed someone to enter a password I would use a dialog, a separate window. When the password entry is done I close the window. If my program needs multiple views, I make multiple views (frames) that are mapped or unmapped. depending on which controls are currently in use. I almost never change the controls in a view and I don't remember the last time I ever deleted a control. I may unmap a control (usually I unmap a frame), but I never delete. I'll probably need it later.
I think you are having a problem deleting your button because you don't have a handle to the button. You provide this example:
And in an earlier example this:
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), 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.
Yes you are right.I understand.I made this mistake in the past(with place() ).
Also I agree with you,maybe a dialog is a good idea for my password function.
I have been using tkinter for about 2 weeks.
Thank you so much Cool

Possibly Related Threads…
Thread Author Replies Views Last Post
  return a variable from a function snakes 3 910 Apr-09-2021, 06:47 PM
Last Post: snakes
  tkinter get function finndude 2 692 Mar-02-2021, 03:53 PM
Last Post: finndude
  Using Tkinter inside function not working Ensaimadeta 3 896 Dec-23-2020, 02:57 PM
Last Post: deanhystad
  function in new window (tkinter) Dale22 7 1,034 Nov-24-2020, 11:28 PM
Last Post: Dale22
Star [Tkinter] How to perform math function in different page of Tkinter GUI ravaru 2 1,229 Oct-23-2020, 05:46 PM
Last Post: deanhystad
  Call local variable of previous function from another function with Python3 & tkinter Hannibal 5 1,259 Oct-12-2020, 09:16 PM
Last Post: deanhystad
  Tkinter menu font size -method to change tonycat 2 2,307 Oct-11-2020, 02:43 AM
Last Post: tonycat
  tkinter get method is not accepting value when called by function jagasrik 1 773 Sep-16-2020, 05:28 AM
Last Post: Yoriz
  tkinter get method is not accepting value jagasrik 4 758 Sep-15-2020, 05:41 PM
Last Post: jagasrik
  [Tkinter] Use function from other class (Tkinter) zarize 8 1,473 Aug-17-2020, 09:47 AM
Last Post: zarize

Forum Jump:

User Panel Messages

Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020