Python Forum
[Tkinter] _tkinter.TclError: can't invoke "destroy" command: application has been destroyed
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
[Tkinter] _tkinter.TclError: can't invoke "destroy" command: application has been destroyed
#7
OK, I added root.focus_set() after defining the root window and the popup window after closing allows focus to remain on the main window and each child window.


root = tk.Tk ()

root.title ("Root Window")  
root.geometry ("512x256")  
root.focus_set()
label1 = Label (root, text = "This is the Root Window")
button = Button (root, text = "Open Toplevel Window")
button.config (command = open_a_toplevel_window)
button1 = Button (root, text = "Open Toplevel Windowb")
button1.config (command = open_b_toplevel_window)
button2 = Button (root, text = "Open Toplevel Windowc")
button2.config (command = open_c_toplevel_window)
label1.pack ()
button2.place (x = 50, y = 75)
button1.place (x = 210, y = 100)
button.place (x = 110, y = 50)
open_d_toplevel_window ()

root.mainloop ()
Reply


Messages In This Thread
RE: _tkinter.TclError: can't invoke "destroy" command: application has been destroyed - by knoxvilles_joker - Apr-25-2021, 08:41 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  tkinter destroy label inside labelFrame Nick_tkinter 3 4,753 Sep-17-2023, 03:38 PM
Last Post: munirashraf9821
Exclamation [Tkinter] Error when closing the main window with destroy TomasSanchexx 1 949 Aug-06-2023, 01:54 AM
Last Post: deanhystad
  tkinter.TclError: can't invoke "canvas" command cybertooth 8 6,515 Feb-23-2023, 06:58 PM
Last Post: deanhystad
  [Tkinter] tkinter.TclError: expected integer but got " " TWB 2 4,024 Feb-19-2023, 05:11 PM
Last Post: TWB
  .get() invoke after a button nested press iddon5 5 3,443 Mar-29-2021, 03:55 AM
Last Post: deanhystad
  Menu destroy Heyjoe 5 3,505 Mar-02-2021, 01:45 AM
Last Post: Heyjoe
  "tkinter.TclError: NULL main window" Rama02 1 6,049 Feb-04-2021, 06:45 PM
Last Post: deanhystad
  [Tkinter] _tkinter.TclError: bitmap "Icon.gif" not defined djwilson0495 2 13,192 Aug-05-2020, 02:27 PM
Last Post: wuf
  [Tkinter] _tkinter.TclError: image "pyimage2" doesn't exist Killdoz 1 10,903 May-30-2020, 09:48 AM
Last Post: menator01
  tkinter.TclError: bad window path name kenwatts275 3 15,146 Apr-26-2020, 08:16 PM
Last Post: kenwatts275

Forum Jump:

User Panel Messages

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