Can't Invoke "event" Command: Application Has Been Destroyed
Solution 1:
So this was a very hard error to find, as debugging never pointed to the right area of code I had to read through the code to try to find something off. So the program gets user input for a keyword, a website is then searched for the events containing this keyword, they are then put into a drop down menu. If there is only one or none occurrence of the keyword then there is no menu displayed and it either clicks the event or it prompts the user with a suggested event that is closest to their keyword. This seemed like the probable area where this error was happening because it only occurred when no menu was displayed. Code from this:
if (len(options) > 1):
button6 = tk.Button(selectMenu, text="Enter",
cursor='pointinghand', command=lambda: self.GetSelection(str(var.GetVars("Selection")), links, options, selectMenu, controller))
msg = "Which one would you like to attend?"
label = tk.Label(selectMenu, text=msg, font="Helvedica 14")
label.pack(side='top', pady=10)
menbutton.pack(side="top", pady=10)
button6.pack(pady=10)
self.Progress()
selectMenu.attributes('-topmost', True)
selectMenu.mainloop()
elif options:
var.SendVars("selLink", links[0])
selectMenu.destroy()
self.Progress()
else:
var.SendVars("Link", 'NO-LINK-FOUND')
selectMenu.destroy()
self.Progress()
It turns out that this error was caused by a Menubutton being created in a tk window but never reaching the mainloop, even though it was destroyed. The error is thrown when the mainloop of another tk window is reached. So to fix this you move the creation of the Menubutton to a place where it will reach it's mainloop as below.
Post a Comment for "Can't Invoke "event" Command: Application Has Been Destroyed"