Another solution is to track if the tk.messagebox
has occurred, and if it has just break/continue/pass to skip over the re-occurring tk.messagebox
:
Flag = False
if Flag:
messagebox.showerror("Error", "Your massage here.")
Flag = True
else:
break
I propose this because I had issues with other solutions proposed on StackOverflow as I don't have a dedicated root.mainloop()
but only have self.mainloop()
within the class Root()
My root looks like this and the massage event is generated within some of the inner classes, where I have no access to self.root:
class Root(tk.Tk):
def __init__(self):
tk.Tk.__init__(self)
....
class 1..
class 2..
self.mainloop()