После двух нажатий закрыть открыть перестает работать

def oboi1():
    oboi = Toplevel(tk)
    oboi.geometry("500x200")                                     
    oboi.title("Выбор обоев")                                    
    oboi.resizable(width=False, height=False)                    
    screen12 = Label(oboi, image=sprosobi)                           
    screen12.grid(row=0, column=0)                                   
    bl = Button(oboi,image = animoct, command = lambda obj=oboi: animeoct(oboi))                                  
    bl.place(x=255,y=100, width=150, height=75)                    
    bl = Button(oboi, image = animoobrat, command = lambda obj=oboi: nanimeno(oboi))                                  
    bl.place(x=70,y=100, width=150, height=75)
def nanimeno(obj):
    global nanimeno
    nanimeno = Toplevel(tk)
    nanimeno.geometry("1280x600")                                    
    nanimeno.title("Обои")                                    
    nanimeno.resizable(width=False, height=False)
    screen13 = Label(nanimeno, image=viberit)                           
    screen13.grid(row=0, column=0)
    bl = Button(nanimeno, image = dalee, command = dale)                                  
    bl.place(x=700,y=530, width=150, height=75)  
    bl = Button(nanimeno, image = vahod, command = exitt3)                                  
    bl.place(x=550,y=530, width=150, height=75)
    ussb.withdraw()
    obj.withdraw()

def dale():
    global dale
    dale = Toplevel(tk)
    dale.geometry("1280x600")                                    
    dale.title("Обои")                                    
    dale.resizable(width=False, height=False)
    screen15 = Label(dale, image=viberit)                           
    screen15.grid(row=0, column=0)
    noanime.withdraw()

def exitt3():
    ussb.deiconify()
    nanimeno.withdraw()
    
    

def animeoct(obj):
    global oboiaime
    oboiaime = Toplevel(tk)
    oboiaime.geometry("1280x600")                                    
    oboiaime.title("Обои")                                    
    oboiaime.resizable(width=False, height=False)
    screen13 = Label(oboiaime, image=viberit)                           
    screen13.grid(row=0, column=0)
    bl = Button(oboiaime, image = dalee, command = dal)                                  
    bl.place(x=700,y=530, width=150, height=75)  
    bl = Button(oboiaime, image = vahod, command = exitt)                                  
    bl.place(x=550,y=530, width=150, height=75)            
    bl = Button(oboiaime, image = liza, command = lizaa)                                  
    bl.place(x=257,y=150, width=256, height=144)
    bl = Button(oboiaime, image = anime2, command = anim2)                                  
    bl.place(x=513,y=150, width=256, height=144)
    bl = Button(oboiaime, image = anime3, command = anim3)                                  
    bl.place(x=769,y=150, width=256, height=144)
    bl = Button(oboiaime, image = anime4, command = anim4)                                  
    bl.place(x=1,y=150, width=256, height=144)
    bl = Button(oboiaime, image = winpirat, command = winrt)                                  
    bl.place(x=1025,y=150, width=256, height=144)
    bl = Button(oboiaime, image = anime5, command = anime55)                                  
    bl.place(x=257,y=296, width=256, height=144)
    bl = Button(oboiaime, image = intell, command = intel)                                  
    bl.place(x=513,y=296, width=256, height=144)
    bl = Button(oboiaime, image = anime6, command = anim6)                                  
    bl.place(x=769,y=296, width=256, height=144)
    bl = Button(oboiaime, image = anime7, command = anim7)                                  
    bl.place(x=1,y=296, width=256, height=144)
    bl = Button(oboiaime, image = huangg, command = huang)                                  
    bl.place(x=1025,y=296, width=256, height=144)
    obj.withdraw()
    ussb.withdraw()

def exitt():
    ussb.deiconify()
    oboiaime.destroy()
    

def dal():
    global dal
    dal = Toplevel(tk)
    dal.geometry("1280x600")                                     
    dal.title("Выбор обоев")                                    
    dal.resizable(width=False, height=False)
    screen13 = Label(dal, image = vibordal)              
    screen13.grid(row=0, column=0)
    bl = Button(dal, image = nazad, command = backk2)                                  
    bl.place(x=400,y=530, width=150, height=75)  
    bl = Button(dal, image = vahod, command = exitt2)                                  
    bl.place(x=550,y=530, width=150, height=75)
    bl = Button(dal, image = dalee, command = epoct)                                  
    bl.place(x=700,y=530, width=150, height=75)
    oboiaime.withdraw()

def exitt2():
    dal.withdraw()
    ussb.deiconify()

def backk2():
    dal.withdraw()
    oboiaime.deiconify()

def epoct():
    global epoct
    epoct = Toplevel(tk)
    epoct.geometry("1280x600")                                     
    epoct.title("Выбор обоев")                                    
    epoct.resizable(width=False, height=False)
    screen14 = Label(epoct, image = vibordal)              
    screen14.grid(row=0, column=0)
    bl = Button(epoct, image = vahod)                                  
    bl.place(x=550,y=530, width=150, height=75)
    bl = Button(epoct, image = nazad, command = backk3)                                  
    bl.place(x=400,y=530, width=150, height=75)
    dal.withdraw()

def backk3():
    epoct.withdraw()
    dal.deiconify()

Суть проблемы открывается окно в нем 3 кнопки, одна открывает еще одно окно, скрывая старое, на следующем окне есть кнопка открывающее старое окно и закрывающее это. Все работает ровно 3 раза, на четвертый кнопка становится не рабочий. Как это исправить ? ошибок в консоли нет


Ответы (0 шт):