<s> import pygtk <EOL> pygtk . require ( '<STR_LIT>' ) <EOL> import gtk <EOL> class EntryExample : <EOL> def enter_callback ( self , widget , entry ) : <EOL> entry_text = entry . get_text ( ) <EOL> print "<STR_LIT>" % entry_text <EOL> def entry_toggle_editable ( self , checkbutton , entry ) : <EOL> entry . set_editable ( checkbutton . get_active ( ) ) <EOL> def entry_toggle_visibility ( self , checkbutton , entry ) : <EOL> entry . set_visibility ( checkbutton . get_active ( ) ) <EOL> def __init__ ( self ) : <EOL> window = gtk . Window ( gtk . WINDOW_TOPLEVEL ) <EOL> window . set_size_request ( <NUM_LIT:200> , <NUM_LIT:100> ) <EOL> window . set_title ( "<STR_LIT>" ) <EOL> window . connect ( "<STR_LIT>" , lambda w , e : gtk . main_quit ( ) ) <EOL> vbox = gtk . VBox ( False , <NUM_LIT:0> ) <EOL> window . add ( vbox ) <EOL> vbox . show ( ) <EOL> entry = gtk . Entry ( ) <EOL> entry . set_max_length ( <NUM_LIT:50> ) <EOL> entry . connect ( "<STR_LIT>" , self . enter_callback , entry ) <EOL> entry . set_text ( "<STR_LIT:hello>" ) <EOL> entry . insert_text ( "<STR_LIT>" , len ( entry . get_text ( ) ) ) <EOL> entry . select_region ( <NUM_LIT:0> , len ( entry . get_text ( ) ) ) <EOL> vbox . pack_start ( entry , True , True , <NUM_LIT:0> ) <EOL> entry . show ( ) <EOL> hbox = gtk . HBox ( False , <NUM_LIT:0> ) <EOL> vbox . add ( hbox ) <EOL> hbox . show ( ) <EOL> check = gtk . CheckButton ( "<STR_LIT>" ) <EOL> hbox . pack_start ( check , True , True , <NUM_LIT:0> ) <EOL> check . connect ( "<STR_LIT>" , self . entry_toggle_editable , entry ) <EOL> check . set_active ( True ) <EOL> check . show ( ) <EOL> check = gtk . CheckButton ( "<STR_LIT>" ) <EOL> hbox . pack_start ( check , True , True , <NUM_LIT:0> ) <EOL> check . connect ( "<STR_LIT>" , self . entry_toggle_visibility , entry ) <EOL> check . set_active ( True ) <EOL> check . show ( ) <EOL> button = gtk . Button ( stock = gtk . STOCK_CLOSE ) <EOL> button . connect ( "<STR_LIT>" , lambda w : gtk . main_quit ( ) ) <EOL> vbox . pack_start ( button , True , True , <NUM_LIT:0> ) <EOL> button . set_flags ( gtk . CAN_DEFAULT ) <EOL> button . grab_default ( ) <EOL> button . show ( ) <EOL> window . show ( ) <EOL> def main ( ) : <EOL> gtk . main ( ) <EOL> return <NUM_LIT:0> <EOL> if __name__ == "<STR_LIT:__main__>" : <EOL> EntryExample ( ) <EOL> main ( ) </s>
