python programming cmd beginfillcommand(color elif command ="endfill"cmd endfillcommand( elif command ="penup"cmd penupcommand( elif command ="pendown"cmd pendowncommand(elseraising an exception will terminate the program immediately which is what we want to happen if we encounter an unknown command the runtimeerror exception is common exception to raise the string will be printed when the exception is printed raise runtimeerror("unknown commandcommand finish processing the record by adding the command to the sequence graphicscommands append(cmd read one more line to set up for the next time through the loop command file readline(strip( this code iterates through the commands to do the drawing and demonstrates the use of the __iter(self)__ method in the pylist class above for cmd in graphicscommandscmd draw( file close( ht(screen exitonclick(print("program execution completed " if __name__ ="__main__"main( implementing gui with tkinter the word gui means graphical user interface implementing graphical user interface in python is very easy using module called tkinter the tcl/tk language and toolkit was designed as cross-platform method of creating gui interfaces python provides an interface to this toolkit via the tkinter module gui is an event-driven program this means that you write your code to respond to events that occur in the program the events occur as result of mouse clicksdragging the mousebutton pressesand menu items being selected to build gui you place widgets in window widgets are any element of gui like labelsbuttonsentry boxesand sometimes invisible widgets called frames frame is widget that can hold other widgets the drawing application you see in fig is one such gui built with tkinter in this section we'll develop this drawing application so you learn how to create your own gui applications using tkinter and to improve or refresh your python programming skills this copy belongs to 'acha