top = Toplevel(root)
top.protocol('WM_DELETE_WINDOW', root.destroy)
but = Button(top, text='deiconify')
but['command'] = root.deiconify
but.pack()
root.mainloop()
Toplevel in Tkinter: Prevent Two Windows from Opening