<s> import pygtk <EOL> pygtk . require ( '<STR_LIT>' ) <EOL> import gtk <EOL> class ToolbarExample : <EOL> def delete_event ( self , widget , event = None ) : <EOL> gtk . main_quit ( ) <EOL> return False <EOL> def radio_event ( self , widget , toolbar ) : <EOL> if self . text_button . get_active ( ) : <EOL> toolbar . set_style ( gtk . TOOLBAR_TEXT ) <EOL> elif self . icon_button . get_active ( ) : <EOL> toolbar . set_style ( gtk . TOOLBAR_ICONS ) <EOL> elif self . both_button . get_active ( ) : <EOL> toolbar . set_style ( gtk . TOOLBAR_BOTH ) <EOL> def toggle_event ( self , widget , toolbar ) : <EOL> toolbar . set_tooltips ( widget . get_active ( ) ) <EOL> def __init__ ( self ) : <EOL> dialog = gtk . Dialog ( ) <EOL> dialog . set_title ( "<STR_LIT>" ) <EOL> dialog . set_size_request ( <NUM_LIT> , <NUM_LIT> ) <EOL> dialog . set_resizable ( True ) <EOL> dialog . connect ( "<STR_LIT>" , self . delete_event ) <EOL> handlebox = gtk . HandleBox ( ) <EOL> dialog . vbox . pack_start ( handlebox , False , False , <NUM_LIT:5> ) <EOL> toolbar = gtk . Toolbar ( ) <EOL> toolbar . set_orientation ( gtk . ORIENTATION_HORIZONTAL ) <EOL> toolbar . set_style ( gtk . TOOLBAR_BOTH ) <EOL> toolbar . set_border_width ( <NUM_LIT:5> ) <EOL> handlebox . add ( toolbar ) <EOL> iconw = gtk . Image ( ) <EOL> iconw . set_from_file ( "<STR_LIT>" ) <EOL> close_button = toolbar . append_item ( <EOL> "<STR_LIT>" , <EOL> "<STR_LIT>" , <EOL> "<STR_LIT>" , <EOL> iconw , <EOL> self . delete_event ) <EOL> toolbar . append_space ( ) <EOL> iconw = gtk . Image ( ) <EOL> iconw . set_from_file ( "<STR_LIT>" ) <EOL> icon_button = toolbar . append_element ( <EOL> gtk . TOOLBAR_CHILD_RADIOBUTTON , <EOL> None , <EOL> "<STR_LIT>" , <EOL> "<STR_LIT>" , <EOL> "<STR_LIT>" , <EOL> iconw , <EOL> self . radio_event , <EOL> toolbar ) <EOL> toolbar . append_space ( ) <EOL> self . icon_button = icon_button <EOL> iconw = gtk . Image ( ) <EOL> iconw . set_from_file ( "<STR_LIT>" ) <EOL> text_button = toolbar . append_element ( <EOL> gtk . TOOLBAR_CHILD_RADIOBUTTON , <EOL> icon_button , <EOL> "<STR_LIT>" , <EOL> "<STR_LIT>" , <EOL> "<STR_LIT>" , <EOL> iconw , <EOL> self . radio_event , <EOL> toolbar ) <EOL> toolbar . append_space ( ) <EOL> self . text_button = text_button <EOL> iconw = gtk . Image ( ) <EOL> iconw . set_from_file ( "<STR_LIT>" ) <EOL> both_button = toolbar . append_element ( <EOL> gtk . TOOLBAR_CHILD_RADIOBUTTON , <EOL> text_button , <EOL> "<STR_LIT>" , <EOL> "<STR_LIT>" , <EOL> "<STR_LIT>" , <EOL> iconw , <EOL> self . radio_event , <EOL> toolbar ) <EOL> toolbar . append_space ( ) <EOL> self . both_button = both_button <EOL> both_button . set_active ( True ) <EOL> iconw = gtk . Image ( ) <EOL> iconw . set_from_file ( "<STR_LIT>" ) <EOL> tooltips_button = toolbar . append_element ( <EOL> gtk . TOOLBAR_CHILD_TOGGLEBUTTON , <EOL> None , <EOL> "<STR_LIT>" , <EOL> "<STR_LIT>" , <EOL> "<STR_LIT>" , <EOL> iconw , <EOL> self . toggle_event , <EOL> toolbar ) <EOL> toolbar . append_space ( ) <EOL> tooltips_button . set_active ( True ) <EOL> entry = gtk . Entry ( ) <EOL> toolbar . append_widget ( entry , "<STR_LIT>" , "<STR_LIT>" ) <EOL> entry . show ( ) <EOL> toolbar . show ( ) <EOL> handlebox . show ( ) <EOL> dialog . show ( ) <EOL> def main ( ) : <EOL> gtk . main ( ) <EOL> return <NUM_LIT:0> <EOL> if __name__ == "<STR_LIT:__main__>" : <EOL> ToolbarExample ( ) <EOL> main ( ) </s>
