#NEWLINE# def __init__( self ) : #NEWLINE# #INDENT# self . liststore = gtk . ListStore ( int , int , int ) #NEWLINE# self . rand = random . Random ( ) #NEWLINE# self . w = ( [ None ] * 3 ) #NEWLINE# for n in range ( 3 ) : #NEWLINE# #INDENT# self . w [ n ] = gtk . Window ( gtk . WINDOW_TOPLEVEL ) #NEWLINE# win = self . w [ n ] #NEWLINE# win . set_title ( ( 'TreeModelSort Example %i' % n ) ) #NEWLINE# win . set_size_request ( 220 , 200 ) #NEWLINE# win . connect ( 'delete_event' , self . delete_event ) #NEWLINE# win . vbox = gtk . VBox ( ) #NEWLINE# win . add ( win . vbox ) #NEWLINE# win . sw = gtk . ScrolledWindow ( ) #NEWLINE# win . sm = gtk . TreeModelSort ( self . liststore ) #NEWLINE# win . sm . set_sort_column_id ( n , gtk . SORT_ASCENDING ) #NEWLINE# win . tv = gtk . TreeView ( win . sm ) #NEWLINE# win . vbox . pack_start ( win . sw ) #NEWLINE# win . b = gtk . Button ( 'Add a Row' ) #NEWLINE# win . b . connect ( 'clicked' , self . add_row ) #NEWLINE# win . vbox . pack_start ( win . b , False ) #NEWLINE# win . sw . add ( win . tv ) #NEWLINE# win . tv . column = ( [ None ] * 3 ) #NEWLINE# win . tv . column [ 0 ] = gtk . TreeViewColumn ( '0-1000' ) #NEWLINE# win . tv . column [ 1 ] = gtk . TreeViewColumn ( '0-1000000' ) #NEWLINE# win . tv . column [ 2 ] = gtk . TreeViewColumn ( '-10000-10000' ) #NEWLINE# win . tv . cell = ( [ None ] * 3 ) #NEWLINE# for i in range ( 3 ) : #NEWLINE# #INDENT# win . tv . cell [ i ] = gtk . CellRendererText ( ) #NEWLINE# win . tv . append_column ( win . tv . column [ i ] ) #NEWLINE# win . tv . column [ i ] . set_sort_column_id ( i ) #NEWLINE# win . tv . column [ i ] . pack_start ( win . tv . cell [ i ] , True ) #NEWLINE# win . tv . column [ i ] . set_attributes ( win . tv . cell [ i ] , text = i ) #NEWLINE# #UNINDENT# win . show_all ( )