contained by are set to expand too herethe button' only parent is the tk root window of the programso parent expandability isn' yet an issuein later exampleswe'll need to make enclosing frame widgets expandable too we will revisit the packer geometry manager when we meet multiple-widget displays that use such devices later in this tutorialand again when we study the alternative grid call in adding user-defined callback handlers in the simple button examples in the preceding sectionthe callback handler was simply an existing function that killed the gui program it' not much more work to register callback handlers that do something bit more useful example - defines callback handler of its own in python example - pp \gui\intro\gui py import sys from tkinter import def quit()print('helloi must be going 'sys exit( custom callback handler kill windows and process widget button(nonetext='hello event world'command=quitwidget pack(widget mainloop(the window created by this script is shown in figure - this script and its gui are almost identical to the last example but herethe command option specifies function we've defined locally when the button is pressedtkinter calls the quit function in this file to handle the eventpassing it zero arguments inside quitthe print call statement types message on the program' stdout streamand the gui process exits as before figure - button that runs python function as usualstdout is normally the window that the program was started from unless it' been redirected to file it' pop-up dos console if you run this program by clicking it on windowsadd an input call before sys exit if you have trouble seeing the message before the pop up disappears here' what the printed output looks like back in standard stream world when the button is pressedit is generated by python function called automatically by tkinter graphical user interfaces