in addition to the event handlers for the widgetsthere are three other event handlers the onclick event occurs when you click the mouse button on the canvas the ondrag event handler occurs when the turtle is dragged around the canvas finallythe undohandler is called when the key is pressed on the keyboard gui drawing application this class defines the drawing application the following line says that the drawingapplication class inherits from the frame class this means that drawingapplication is like frame object except for the code written here which redefines/extends the behavior of frame class drawingapplication(tkinter frame)def __init__(selfmaster=none)super(__init__(masterself pack(self buildwindow(self graphicscommands pylist( this method is called to create all the widgetsplace them in the guiand define the event handlers for the application def buildwindow(self) the master is the root window the title is set as below self master title("draw" here is how to create menu bar the tearoff= means that menus can' be separated from the window which is feature of tkinter bar tkinter menu(self masterfilemenu tkinter menu(bar,tearoff= this code is called by the "newmenu item below when it is selected the same applies for loadfileaddtofileand savefile below the "exitmenu item below calls quit on the "masteror root window def newwindow()this sets up the turtle to be ready for new picture to be drawn it also sets the sequence back to empty it is necessary for the graphicscommands sequence to be in the object ( self graphicscommandsbecause otherwise the statementgraphicscommands pylist(would make this variable local variable in the newwindow method if it were localit would not be set anymore once the newwindow method returned theturtle clear(theturtle penup(theturtle goto( , theturtle pendown(screen update(screen listen(self graphicscommands pylist( filemenu add_command(label="new",command=newwindow the parse function adds the contents of an xml file to the sequence def parse(filename)xmldoc xml dom minidom parse(filename graphicscommandselement xmldoc getelementsbytagname("graphicscommands")[ graphicscommands graphicscommandselement getelementsbytagname("command" for commandelement in graphicscommandsprint(type(commandelement)command commandelement firstchild data strip(attr commandelement attributes if command ="goto"this copy belongs to 'acha