windowinstead of sys exit to shut down the entire programto see how this method really does its worklet' move on to window protocols top-level window protocols both tk and toplevel widgets export extra methods and features tailored for their toplevel roleas illustrated in example - example - pp \gui\tour\toplevel py ""pop up three new windowswith style destroy(kills one windowquit(kills all windows and app (ends mainloop)top-level windows have titleiconiconify/deiconify and protocol for wm eventsthere always is an application root windowwhether by default or created as an explicit tk(objectall top-level windows are containersbut they are never packed/griddedtoplevel is like framebut new windowand can have menu""from tkinter import root tk(explicit root trees [('the larch!''light blue')('the pine!''light green')('the giant redwood!''red')for (treecolorin treeswin toplevel(rootwin title('sing 'win protocol('wm_delete_window'lambda:nonewin iconbitmap('py-blue-trans-out ico'new window set border ignore close not red tk msg button(wintext=treecommand=win destroykills one win msg pack(expand=yesfill=bothmsg config(padx= pady= bd= relief=raisedmsg config(bg='black'fg=colorfont=('times' 'bold italic')root title('lumberjack demo'label(roottext='main window'width= pack(button(roottext='quit all'command=root quitpack(root mainloop(kills all app this program adds widgets to the tk root windowimmediately pops up three toplevel windows with attached buttonsand uses special top-level protocols when runit generates the scene captured in living black-and-white in figure - (the buttonstext shows up bluegreenand red on color display tkinter tourpart