Package schrodinger :: Package application :: Package desmond :: Module table :: Class Table
[hide private]
[frames] | no frames]

Class Table

           ui.widget.pmwwidget.schroPmwWrapper --+    
                                                 |    
_Pmw.Pmw_1_2.lib.PmwBase.MegaArchetype --+       |    
                                         |       |    
       _Pmw.Pmw_1_2.lib.PmwBase.MegaWidget --+   |    
                                             |   |    
        ui.widget._private._fixedScrolledFrame --+    
                                                 |    
                 ui.widget.pmwwidget.ScrolledFrame --+
                                                     |
                                                    Table

A table widget class.

Class attributes:

Object attributes:

Read-only object attributes:

Instance Methods [hide private]
 
__init__(self, master, columns, n_row, widget=[[], []], septhickness=2, seprelief='sunken', handlesize=0, title_bg='LightSteelBlue', title_bg_active='light blue')
Constructor.
 
_map_event_handler(self, *arg, **kwarg)
 
_unmap_event_handler(self, *arg, **kwarg)
 
_get_geometry(self, widget)
 
_focusin_event_handler(self, *arg, **kwarg)
 
_mw_event_handler(self, *arg, **kw)
 
_activate_vbar_mw(self, *arg, **kw)
 
_deactivate_mw(self, *arg, **kw)
 
_activate_hbar_mw(self, *arg, **kw)
 
_gen_title(self, master, title)
Generates a title object and places it on the top of the 'master' frame, and then returns the object.
 
_command(self, sizes)
Adjusts the total width of the table by changing the width of the rightmost dummy column.
 
_set_height(self)
Sets the height of the entire table widget and also of the columns' hull.
 
_set_width(self, delta_width=0)
Sets the width of the columns' hull.
 
_set_row_bg(self, i_row, color=None)
Sets the background color of a given row 'i_row' to 'color'.
 
_click_cell(self, cell)
Mouse-click (left button) event handling function It does the following things in order:
 
_s_click_cell(self, cell)
Shift-mouse-click (left button + <Shift> key) event handling function.
 
_c_click_cell(self, cell)
Ctrl-mouse-click (left button + <Ctrl> key) event handling function It does the following things in order:
 
_dclick_cell(self, cell)
Double-mouse-click event handling function.
 
select_row(self, i_row)
Adds the 'i_row'-th row into the row selection.
 
select_n_rows(self, rows)
Adds multiple rows whose indices are given by the list 'rows' into the row selection.
 
unselect_row(self, i_row)
Removes the 'i_row'-th row from the row selection.
 
unselect_n_rows(self, rows)
Removes multiple rows whose indices are given by the list 'rows' from the row selection.
 
config(self, i_col, row_from=0, row_to=None, var=None, **kw)
Configures the cells from the 'row_from'-th row to the 'row_to'-th row on the 'i_col'-th column.
 
bind(self, event, handler, i_col, row_from=0, row_to=None)
Binds an event handler for the cells from 'row_from'-th row to 'row_to'-th row on the 'i_col'-th column.
 
grid(self, sticky='we', **kw)
Widget-gridding function.
 
pack(self, fill='x', **kw)
Widget-packing function.
 
sel_rows(self)
Returns a list of selected row indices.
 
watch_sel(self, command)
Sets a callback function in response to change of row selection.
 
add_row(self, widget=None)
Appends a row at the bottom of the table.
 
del_row(self, i_row)
Deletes the 'i_row'-th row.
 
del_n_rows(self, rows)
Deletes a few rows whose indices are passed in a list 'rows'.
 
add_col(self, column, widget=0)
Adds a column just to the left of the dummy column.
 
del_col(self, i_col)
Deletes the 'i_col'-th column.

Inherited from ui.widget.pmwwidget.schroPmwWrapper: cleanup_components

Inherited from ui.widget._private._fixedScrolledFrame: destroy, interior, reposition, xview, yview

Inherited from ui.widget._private._fixedScrolledFrame (private): _getxview, _getyview, _horizflex, _hscrollMode, _reposition, _scrollBothNow, _toggleHorizScrollbar, _toggleVertScrollbar, _vertflex, _vscrollMode

Inherited from _Pmw.Pmw_1_2.lib.PmwBase.MegaWidget: after, after_cancel, after_idle, bbox, bell, bind_all, bind_class, bindtags, clipboard_append, clipboard_clear, clipboard_get, colormodel, columnconfigure, deletecommand, event_add, event_delete, event_generate, event_info, focus, focus_displayof, focus_force, focus_get, focus_lastfor, focus_set, forget, getboolean, getvar, grab_current, grab_release, grab_set, grab_set_global, grab_status, grid_bbox, grid_columnconfigure, grid_configure, grid_forget, grid_info, grid_location, grid_propagate, grid_remove, grid_rowconfigure, grid_size, grid_slaves, image_names, image_types, info, keys, lift, lower, mainloop, nametowidget, option_add, option_clear, option_get, option_readfile, pack_configure, pack_forget, pack_info, pack_propagate, pack_slaves, place, place_configure, place_forget, place_info, place_slaves, propagate, quit, register, rowconfigure, selection_clear, selection_get, selection_handle, selection_own, selection_own_get, send, setvar, size, slaves, tk_bisque, tk_focusFollowsMouse, tk_focusNext, tk_focusPrev, tk_menuBar, tk_setPalette, tk_strictMotif, tkraise, unbind, unbind_all, unbind_class, update, update_idletasks, wait_variable, wait_visibility, wait_window, waitvar, winfo_atom, winfo_atomname, winfo_cells, winfo_children, winfo_class, winfo_colormapfull, winfo_containing, winfo_depth, winfo_exists, winfo_fpixels, winfo_geometry, winfo_height, winfo_id, winfo_interps, winfo_ismapped, winfo_manager, winfo_name, winfo_parent, winfo_pathname, winfo_pixels, winfo_pointerx, winfo_pointerxy, winfo_pointery, winfo_reqheight, winfo_reqwidth, winfo_rgb, winfo_rootx, winfo_rooty, winfo_screen, winfo_screencells, winfo_screendepth, winfo_screenheight, winfo_screenmmheight, winfo_screenmmwidth, winfo_screenvisual, winfo_screenwidth, winfo_server, winfo_toplevel, winfo_viewable, winfo_visual, winfo_visualid, winfo_visualsavailable, winfo_vrootheight, winfo_vrootwidth, winfo_vrootx, winfo_vrooty, winfo_width, winfo_x, winfo_y

Inherited from _Pmw.Pmw_1_2.lib.PmwBase.MegaArchetype: __getitem__, __setitem__, __str__, addoptions, cget, component, componentaliases, componentgroup, components, configure, createcomponent, createlabel, defineoptions, destroycomponent, hulldestroyed, initialiseoptions, isinitoption, options

Class Variables [hide private]
  LABEL = 0
  ENTRY = 1
  ENTRYFIELD = 2
  RADIOBUTTON = 3
  CHECKBUTTON = 4
  COMBOBOX = 5
  BUTTON = 6
  SPINBOX = 7
  WIDGET_LOOK = ({'anchor': 'w', 'bd': 0, 'justify': 'left', 'pa...
Method Details [hide private]

__init__(self, master, columns, n_row, widget=[[], []], septhickness=2, seprelief='sunken', handlesize=0, title_bg='LightSteelBlue', title_bg_active='light blue')
(Constructor)

 

Constructor.

Parameters:
  • columns - - A tuple. Each element is a tuple of three integers plus a string: minimal column width, maximal column width, initial column width, and the title of the column (which can be either a string or a 'PhotoImage' object). The unit of the width is pixel. For example, columns = ((20, 100, 50, 'X'), (20, 100, 50, 'Y'),)
  • n_row - - Number of rows.
  • septhickness - - Thickness of verticle separator lines (default = 2 pixels).
  • seprelief - - Relief state of the column-column separator lines.
  • handlesize - - Size of the handle (the little square that one can drag to right or left to adjust the column width), default value is 8 pixels.
  • title_bg - - The title buttons' background color. Default = 'LightSteelBlue'.
  • title_bg_active - - The background color of the title buttons at the active state. Default = 'light blue'.
  • widget - - A list of two elements. The first element is a list of column indices (integer numbers; the first column's index is 0). The second element is a list of widget types (be one of these values: 'LABEL', 'ENTRY', 'RADIOBUTTON', and 'CHECKBUTTON', meaning that the widgets in the column as indicated by the corresponding integer in the first element of the 'widget' list will be constructed to be this type of widget. If no specification, all widgets will be 'LABEL'. Default = [[], []], i.e., widgets are 'LABEL' in all columns. For example, '[[1, 3, 2], [ENTRY, CHECKBUTTON, RADIOBUTTON]]' means that the 2st column will be 'ENTRY', the 4th column will be 'CHECKBUTTON', and 3rd column will be 'RADIOBUTTON'.
Overrides: _Pmw.Pmw_1_2.lib.PmwBase.MegaArchetype.__init__

_gen_title(self, master, title)

 

Generates a title object and places it on the top of the 'master' frame, and then returns the object.

Parameters:
  • title - Either a string or a 'PhotoImage' object to be shown on the title object.

_set_width(self, delta_width=0)

 

Sets the width of the columns' hull.

After adding a column (or pane) to the hull, you must call this function to expand the hull's size accordingly.

You do NOT need to call this function if you delete a column (or pane).

_set_row_bg(self, i_row, color=None)

 

Sets the background color of a given row 'i_row' to 'color'. If 'color' is not provided or 'color' is None, the original color of the widget will be used.

_click_cell(self, cell)

 

Mouse-click (left button) event handling function It does the following things in order:

  1. Changes the color of the present row and recovers that of the previously selected row(s).
  2. Resets the variable for storing row selection.
  3. Calls user's event handling function (if it exists).
  4. If the user provided a function in response to the change of row selection, we call that.

_s_click_cell(self, cell)

 

Shift-mouse-click (left button + <Shift> key) event handling function.

It does the following things in order:

  1. Treats selection and color of rows.
  2. If the user provided a function in response to the change of row selection, we call that.

_c_click_cell(self, cell)

 

Ctrl-mouse-click (left button + <Ctrl> key) event handling function It does the following things in order:

  1. Treats selection and color of rows.
  2. If the user provided a function in response to the change of row selection, we call that.

_dclick_cell(self, cell)

 

Double-mouse-click event handling function. It just calls the user-provided function (if it exists) with the 'cell' object that recieved the click event.

unselect_row(self, i_row)

 

Removes the 'i_row'-th row from the row selection. No effect if the row is not yet in the selection.

unselect_n_rows(self, rows)

 

Removes multiple rows whose indices are given by the list 'rows' from the row selection. If an item in 'rows' is not in the current selection, it will be ignored.

config(self, i_col, row_from=0, row_to=None, var=None, **kw)

 

Configures the cells from the 'row_from'-th row to the 'row_to'-th
row on the 'i_col'-th column. Both row and column indices start from
0.

Overrides: _Pmw.Pmw_1_2.lib.PmwBase.MegaWidget.config

bind(self, event, handler, i_col, row_from=0, row_to=None)

 

Binds an event handler for the cells from 'row_from'-th row to 'row_to'-th row on the 'i_col'-th column. Both row and column indices start from 0.

The event handler should take 1 argument, which will be the cell object on which the event was created. The handler can get the row and column indices by calling cell.row_index() and cell.col_index(), respectively.

Overrides: _Pmw.Pmw_1_2.lib.PmwBase.MegaWidget.bind

grid(self, sticky='we', **kw)

 

Widget-gridding function. Usage is the same as the standard grid function.

Overrides: _Pmw.Pmw_1_2.lib.PmwBase.MegaWidget.grid

pack(self, fill='x', **kw)

 

Widget-packing function. Usage is the same as the standard pack function.

Overrides: _Pmw.Pmw_1_2.lib.PmwBase.MegaWidget.pack

add_row(self, widget=None)

 

Appends a row at the bottom of the table.

If 'widget' is not provided, the widget provided to the 'Table' object's constructor will be used.

Parameters:
  • widget - A list of two elements, in the same format as that for 'widget' arguments to the constructor. (See the class docstring for documentation.)

del_row(self, i_row)

 

Deletes the 'i_row'-th row.

Note that when 'i_row'-th row is deleted, the indices of the rows after it will be changed.

If you want to delete more than 1 rows, use the del_n_rows method.

add_col(self, column, widget=0)

 

Adds a column just to the left of the dummy column.

Parameters:
  • column - A tuple in the same format as that of the 'columns' argument to the consntructor. (See the class docstring for documentation.)
  • widget - The type of widget, taking a value of the following: 'Table.LABEL', 'Table.ENTRY', 'Table.RADIOBUTTON', and 'Table.CHECKBUTTON'. The default value is 'Table.LABEL'

Class Variable Details [hide private]

WIDGET_LOOK

Value:
({'anchor': 'w',
  'bd': 0,
  'justify': 'left',
  'padx': 2,
  'pady': 4,
  'relief': 'flat'},
 {'bd': 1,
  'bg': 'white',
...