from tkinter import * root = Tk() root.geometry("200x100") class tk_(): def __init__(self): Button(text="press").pack() root.bind('<Unmap>', self.curtail_win) def curtail_win(self,event): print("Error") def bind_all(self): print("Bind") tk = tk_() root.mainloop() For some reason, the curtail_win function curtail_win called as many times as there are widgets on it + window itself
Conclusion:
Error Error The function was called 2 times, ie the Window + Button = 2 times the function call
from tkinter import * root = Tk() root.geometry("200x100") class tk_(): def __init__(self): Button(text="Press").pack() Button(text="New").pack() root.bind('<Unmap>', self.curtail_win) def curtail_win(self,event): print("Error") def bind_all(self): print("Bind") tk = tk_() root.mainloop() Here already 3 times Conclusion:
Error Error Error Here already: Window + Button + Button = 3