#------------------------------------------------------------------------- # Sample data: #------------------------------------------------------------------------- people = [['Dave', 39, '555-1212'], ['Mike', 28, '555-3526'], ['Joe', 34, '555-6943'], ['Tom', 22, '555-7586'], ['Dick', 63, '555-3895'], ['Harry', 46, '555-3285'], ['Sally', 43, '555-8797'], ['Fields', 31, '555-3547']] #------------------------------------------------------------------------- # Table editor definition: #------------------------------------------------------------------------- table_editor = TableEditor( columns=[ ListColumn(index=0, label='Name'), ListColumn(index=1, label='Age'), ListColumn(index=2, label='Phone') ], editable=False, show_column_labels=True, # ) #------------------------------------------------------------------------- # 'TableTest' class: #------------------------------------------------------------------------- class TableTest(HasStrictTraits): #-------------------------------------------------------------------------
def _get_columns(self): return [ ListColumn(label=name, index=index) for index, name in enumerate(self.analysis_model.header) ]