pydraw wxpython example application class pydrawcontrollerdef __init__(selfview)self view view set the initial mode self mode pydrawconstants square_mode def set_circle_mode(self)self mode pydrawconstants circle_mode def set_line_mode(self)self mode pydrawconstants line_mode def set_square_mode(self)self mode pydrawconstants square_mode def set_text_mode(self)self mode pydrawconstants text_mode def clear_drawing(self)self view drawing_controller clear(def get_mode(self)return self mode def command_menu_handler(selfcommand_event)id command_event getid(if id =wx id_newprint('clear the drawing area'self clear_drawing(elif id =wx id_openprint('open drawing file'elif id =wx id_saveprint('save drawing file'elif id =wx id_exitprint('quite the application'self view close(elif id =pydrawconstants line_idprint('set drawing mode to line'self set_line_mode(elif id =pydrawconstants square_idprint('set drawing mode to square'self set_square_mode(elif id =pydrawconstants circle_idprint('set drawing mode to circle'self set_circle_mode(elif id =pydrawconstants text_idprint('set drawing mode to text'self set_text_mode(elseprint('unknown option'id