<s> import pygtk <EOL> pygtk . require ( '<STR_LIT>' ) <EOL> import gtk <EOL> def make_menu_item ( name , callback , data = None ) : <EOL> item = gtk . MenuItem ( name ) <EOL> item . connect ( "<STR_LIT>" , callback , data ) <EOL> item . show ( ) <EOL> return item <EOL> def scale_set_default_values ( scale ) : <EOL> scale . set_update_policy ( gtk . UPDATE_CONTINUOUS ) <EOL> scale . set_digits ( <NUM_LIT:1> ) <EOL> scale . set_value_pos ( gtk . POS_TOP ) <EOL> scale . set_draw_value ( True ) <EOL> class RangeWidgets : <EOL> def cb_pos_menu_select ( self , item , pos ) : <EOL> self . hscale . set_value_pos ( pos ) <EOL> self . vscale . set_value_pos ( pos ) <EOL> def cb_update_menu_select ( self , item , policy ) : <EOL> self . hscale . set_update_policy ( policy ) <EOL> self . vscale . set_update_policy ( policy ) <EOL> def cb_digits_scale ( self , adj ) : <EOL> self . hscale . set_digits ( adj . value ) <EOL> self . vscale . set_digits ( adj . value ) <EOL> def cb_page_size ( self , get , set ) : <EOL> set . page_size = get . value <EOL> set . page_incr = get . value <EOL> set . emit ( "<STR_LIT>" ) <EOL> def cb_draw_value ( self , button ) : <EOL> self . hscale . set_draw_value ( button . get_active ( ) ) <EOL> self . vscale . set_draw_value ( button . get_active ( ) ) <EOL> def __init__ ( self ) : <EOL> self . window = gtk . Window ( gtk . WINDOW_TOPLEVEL ) <EOL> self . window . connect ( "<STR_LIT>" , lambda w : gtk . main_quit ( ) ) <EOL> self . window . set_title ( "<STR_LIT>" ) <EOL> box1 = gtk . VBox ( False , <NUM_LIT:0> ) <EOL> self . window . add ( box1 ) <EOL> box1 . show ( ) <EOL> box2 = gtk . HBox ( False , <NUM_LIT:10> ) <EOL> box2 . set_border_width ( <NUM_LIT:10> ) <EOL> box1 . pack_start ( box2 , True , True , <NUM_LIT:0> ) <EOL> box2 . show ( ) <EOL> adj1 = gtk . Adjustment ( <NUM_LIT:0.0> , <NUM_LIT:0.0> , <NUM_LIT> , <NUM_LIT:0.1> , <NUM_LIT:1.0> , <NUM_LIT:1.0> ) <EOL> self . vscale = gtk . VScale ( adj1 ) <EOL> scale_set_default_values ( self . vscale ) <EOL> box2 . pack_start ( self . vscale , True , True , <NUM_LIT:0> ) <EOL> self . vscale . show ( ) <EOL> box3 = gtk . VBox ( False , <NUM_LIT:10> ) <EOL> box2 . pack_start ( box3 , True , True , <NUM_LIT:0> ) <EOL> box3 . show ( ) <EOL> self . hscale = gtk . HScale ( adj1 ) <EOL> self . hscale . set_size_request ( <NUM_LIT:200> , <NUM_LIT:30> ) <EOL> scale_set_default_values ( self . hscale ) <EOL> box3 . pack_start ( self . hscale , True , True , <NUM_LIT:0> ) <EOL> self . hscale . show ( ) <EOL> scrollbar = gtk . HScrollbar ( adj1 ) <EOL> scrollbar . set_update_policy ( gtk . UPDATE_CONTINUOUS ) <EOL> box3 . pack_start ( scrollbar , True , True , <NUM_LIT:0> ) <EOL> scrollbar . show ( ) <EOL> box2 = gtk . HBox ( False , <NUM_LIT:10> ) <EOL> box2 . set_border_width ( <NUM_LIT:10> ) <EOL> box1 . pack_start ( box2 , True , True , <NUM_LIT:0> ) <EOL> box2 . show ( ) <EOL> button = gtk . CheckButton ( "<STR_LIT>" ) <EOL> button . set_active ( True ) <EOL> button . connect ( "<STR_LIT>" , self . cb_draw_value ) <EOL> box2 . pack_start ( button , True , True , <NUM_LIT:0> ) <EOL> button . show ( ) <EOL> box2 = gtk . HBox ( False , <NUM_LIT:10> ) <EOL> box2 . set_border_width ( <NUM_LIT:10> ) <EOL> label = gtk . Label ( "<STR_LIT>" ) <EOL> box2 . pack_start ( label , False , False , <NUM_LIT:0> ) <EOL> label . show ( ) <EOL> opt = gtk . OptionMenu ( ) <EOL> menu = gtk . Menu ( ) <EOL> item = make_menu_item ( "<STR_LIT>" , self . cb_pos_menu_select , gtk . POS_TOP ) <EOL> menu . append ( item ) <EOL> item = make_menu_item ( "<STR_LIT>" , self . cb_pos_menu_select , <EOL> gtk . POS_BOTTOM ) <EOL> menu . append ( item ) <EOL> item = make_menu_item ( "<STR_LIT>" , self . cb_pos_menu_select , gtk . POS_LEFT ) <EOL> menu . append ( item ) <EOL> item = make_menu_item ( "<STR_LIT>" , self . cb_pos_menu_select , gtk . POS_RIGHT ) <EOL> menu . append ( item ) <EOL> opt . set_menu ( menu ) <EOL> box2 . pack_start ( opt , True , True , <NUM_LIT:0> ) <EOL> opt . show ( ) <EOL> box1 . pack_start ( box2 , True , True , <NUM_LIT:0> ) <EOL> box2 . show ( ) <EOL> box2 = gtk . HBox ( False , <NUM_LIT:10> ) <EOL> box2 . set_border_width ( <NUM_LIT:10> ) <EOL> label = gtk . Label ( "<STR_LIT>" ) <EOL> box2 . pack_start ( label , False , False , <NUM_LIT:0> ) <EOL> label . show ( ) <EOL> opt = gtk . OptionMenu ( ) <EOL> menu = gtk . Menu ( ) <EOL> item = make_menu_item ( "<STR_LIT>" , self . cb_update_menu_select , <EOL> gtk . UPDATE_CONTINUOUS ) <EOL> menu . append ( item ) <EOL> item = make_menu_item ( "<STR_LIT>" , self . cb_update_menu_select , <EOL> gtk . UPDATE_DISCONTINUOUS ) <EOL> menu . append ( item ) <EOL> item = make_menu_item ( "<STR_LIT>" , self . cb_update_menu_select , <EOL> gtk . UPDATE_DELAYED ) <EOL> menu . append ( item ) <EOL> opt . set_menu ( menu ) <EOL> box2 . pack_start ( opt , True , True , <NUM_LIT:0> ) <EOL> opt . show ( ) <EOL> box1 . pack_start ( box2 , True , True , <NUM_LIT:0> ) <EOL> box2 . show ( ) <EOL> box2 = gtk . HBox ( False , <NUM_LIT:10> ) <EOL> box2 . set_border_width ( <NUM_LIT:10> ) <EOL> label = gtk . Label ( "<STR_LIT>" ) <EOL> box2 . pack_start ( label , False , False , <NUM_LIT:0> ) <EOL> label . show ( ) <EOL> adj2 = gtk . Adjustment ( <NUM_LIT:1.0> , <NUM_LIT:0.0> , <NUM_LIT> , <NUM_LIT:1.0> , <NUM_LIT:1.0> , <NUM_LIT:0.0> ) <EOL> adj2 . connect ( "<STR_LIT>" , self . cb_digits_scale ) <EOL> scale = gtk . HScale ( adj2 ) <EOL> scale . set_digits ( <NUM_LIT:0> ) <EOL> box2 . pack_start ( scale , True , True , <NUM_LIT:0> ) <EOL> scale . show ( ) <EOL> box1 . pack_start ( box2 , True , True , <NUM_LIT:0> ) <EOL> box2 . show ( ) <EOL> box2 = gtk . HBox ( False , <NUM_LIT:10> ) <EOL> box2 . set_border_width ( <NUM_LIT:10> ) <EOL> label = gtk . Label ( "<STR_LIT>" ) <EOL> box2 . pack_start ( label , False , False , <NUM_LIT:0> ) <EOL> label . show ( ) <EOL> adj2 = gtk . Adjustment ( <NUM_LIT:1.0> , <NUM_LIT:1.0> , <NUM_LIT> , <NUM_LIT:1.0> , <NUM_LIT:1.0> , <NUM_LIT:0.0> ) <EOL> adj2 . connect ( "<STR_LIT>" , self . cb_page_size , adj1 ) <EOL> scale = gtk . HScale ( adj2 ) <EOL> scale . set_digits ( <NUM_LIT:0> ) <EOL> box2 . pack_start ( scale , True , True , <NUM_LIT:0> ) <EOL> scale . show ( ) <EOL> box1 . pack_start ( box2 , True , True , <NUM_LIT:0> ) <EOL> box2 . show ( ) <EOL> separator = gtk . HSeparator ( ) <EOL> box1 . pack_start ( separator , False , True , <NUM_LIT:0> ) <EOL> separator . show ( ) <EOL> box2 = gtk . VBox ( False , <NUM_LIT:10> ) <EOL> box2 . set_border_width ( <NUM_LIT:10> ) <EOL> box1 . pack_start ( box2 , False , True , <NUM_LIT:0> ) <EOL> box2 . show ( ) <EOL> button = gtk . Button ( "<STR_LIT>" ) <EOL> button . connect ( "<STR_LIT>" , lambda w : gtk . main_quit ( ) ) <EOL> box2 . pack_start ( button , True , True , <NUM_LIT:0> ) <EOL> button . set_flags ( gtk . CAN_DEFAULT ) <EOL> button . grab_default ( ) <EOL> button . show ( ) <EOL> self . window . show ( ) <EOL> def main ( ) : <EOL> gtk . main ( ) <EOL> return <NUM_LIT:0> <EOL> if __name__ == "<STR_LIT:__main__>" : <EOL> RangeWidgets ( ) <EOL> main ( ) </s>
