code: def set_table_cb(self, viewer, table):
          
          self.clear()
          tree_dict = OrderedDict()
  
          # Extract data as astropy table
          a_tab = table.get_data()
  
          # Fill masked values, if applicable
          try:
              a_tab = a_tab.filled()
          except Exception:  # Just use original table
              pass
  
          # This is to get around table widget not sorting numbers properly
          i_fmt = '{{0:0{0}d}}'.format(len(str(len(a_tab))))
  
          # Table header with units
          columns = [('Row', '_DISPLAY_ROW')]
          for c in a_tab.columns.values():
              col_str = '{0:^s}\n{1:^s}'.format(c.name, str(c.unit))
              columns.append((col_str, c.name))
  
          self.widget.setup_table(columns, 1, '_DISPLAY_ROW')
  
          # Table contents
          for i, row in enumerate(a_tab, 1):
              bnch = Bunch.Bunch(zip(row.colnames, row.as_void()))
              i_str = i_fmt.format(i)
              bnch['_DISPLAY_ROW'] = i_str
              tree_dict[i_str] = bnch
  
          self.widget.set_tree(tree_dict)
  
          # Resize column widths
          n_rows = len(tree_dict)
          if n_rows < self.settings.get('max_rows_for_col_resize', 5000):
              self.widget.set_optimal_column_widths()
              self.logger.debug('Resized columns for {0} row(s)'.format(n_rows))
  
          tablename = table.get('name', 'NoName')
          self.logger.debug('Displayed {0}'.format(tablename))
docs: Display the given table object.