python programming widthentry pack(widthsize set(str( ) radiuslabel tkinter label(sidebar,text="radius"radiuslabel pack(radiussize tkinter stringvar(radiusentry tkinter entry(sidebar,textvariable=radiussizeradiussize set(str( )radiusentry pack( button widget calls an event handler when it is pressed the circlehandler function below is the event handler when the draw circle button is pressed def circlehandler()when drawinga command is created and then the command is drawn by calling the draw method adding the command to the graphicscommands sequence means the application will remember the picture cmd circlecommand(float(radiussize get())float(widthsize get())pencolor get()cmd draw(theturtleself graphicscommands append(cmd these two lines are needed to update the screen and to put the focus back in the drawing canvas this is necessary because when pressing "uto undothe screen must have focus to receive the key press screen update(screen listen( this creates the button widget in the sidebar the fill=tkinter both causes the button to expand to fill the entire width of the sidebar circlebutton tkinter button(sidebartext "draw circle"command=circlehandlercirclebutton pack(fill=tkinter both the color mode below allows colors to be specified in rgb form ( redgreen/bluethe mode allows the red value to be set by two digit hexadecimal number ranging from -ff the same applies for blue and green values the color choosers below return string representing the selected color and slice is taken to extract the #rrggbb hexadecimal string that the color choosers return screen colormode( penlabel tkinter label(sidebar,text="pen color"penlabel pack(pencolor tkinter stringvar(penentry tkinter entry(sidebar,textvariable=pencolorpenentry pack(this is the color black pencolor set("# " def getpencolor()color tkinter colorchooser askcolor(if color !nonepencolor set(str(color)[- :- ] pencolorbutton tkinter button(sidebartext "pick pen color"command=getpencolorpencolorbutton pack(fill=tkinter both filllabel tkinter label(sidebar,text="fill color"filllabel pack(fillcolor tkinter stringvar(fillentry tkinter entry(sidebar,textvariable=fillcolorfillentry pack(fillcolor set("# " def getfillcolor()color tkinter colorchooser askcolor(if color !nonefillcolor set(str(color)[- :- ] fillcolorbutton tkinter button(sidebartext "pick fill color"command=getfillcolorfillcolorbutton pack(fill=tkinter both this copy belongs to 'acha