<s> """<STR_LIT>""" <EOL> from traits . api import HasPrivateTraits , Str , Int , Enum , Instance , Button <EOL> from traitsui . api import View , HGroup , Item , Handler , UIInfo , spring <EOL> class PersonHandler ( Handler ) : <EOL> info = Instance ( UIInfo ) <EOL> cancel = Button ( '<STR_LIT>' ) <EOL> view = View ( <EOL> HGroup ( <EOL> spring , <EOL> Item ( '<STR_LIT>' , show_label = False ) , <EOL> ) , <EOL> kind = '<STR_LIT>' <EOL> ) <EOL> def object_gender_changed ( self , info ) : <EOL> if info . initialized : <EOL> self . info = info <EOL> self . _ui = self . edit_traits ( parent = info . gender . control ) <EOL> def _cancel_changed ( self ) : <EOL> object = self . info . object <EOL> object . gender = [ '<STR_LIT>' , '<STR_LIT>' ] [ object . gender == '<STR_LIT>' ] <EOL> self . _ui . dispose ( ) <EOL> class Person ( HasPrivateTraits ) : <EOL> name = Str <EOL> age = Int <EOL> gender = Enum ( '<STR_LIT>' , '<STR_LIT>' ) <EOL> traits_view = View ( <EOL> Item ( '<STR_LIT:name>' ) , <EOL> Item ( '<STR_LIT>' ) , <EOL> Item ( '<STR_LIT>' ) , <EOL> title = '<STR_LIT>' , <EOL> handler = PersonHandler <EOL> ) <EOL> demo = Person ( name = '<STR_LIT>' , age = <NUM_LIT:32> ) <EOL> if __name__ == '<STR_LIT:__main__>' : <EOL> demo . configure_traits ( ) </s>
