Package nltk :: Package draw :: Module table :: Class MultiListbox
[hide private]
[frames] | no frames]

Class MultiListbox

source code

  Tkinter.Misc --+            
                 |            
Tkinter.BaseWidget --+        
                     |        
      Tkinter.Pack --+        
                     |        
     Tkinter.Place --+        
                     |        
      Tkinter.Grid --+        
                     |        
        Tkinter.Widget --+    
                         |    
             Tkinter.Frame --+
                             |
                            MultiListbox

A multi-column listbox, where the current selection applies to an entire row. Based on the 'MultiListbox Tkinter widget' recipe from the Python Cookbook.

For the most part, MultiListbox's methods just delegate to its contained listboxes. For any methods that do not have docstrings, see Tkinter.Listbox for a description of what that method does.

Nested Classes [hide private]

Inherited from Tkinter.Misc: getdouble, getint

Instance Methods [hide private]
 
__init__(self, master, columns, column_weights=None, cnf={}, **kw)
Construct a new multi-column listbox widget.
source code
 
_resize_column(self, event)
Callback used to resize a column of the table.
source code
 
_resize_column_motion_cb(self, event) source code
 
_resize_column_buttonrelease_cb(self, event) source code
 
_select(self, e) source code
 
_scroll(self, delta) source code
 
_pagesize(self)
Returns: The number of rows that makes up one page
source code
 
select(self, index=None, delta=None, see=True)
Set the selected row.
source code
 
configure(self, cnf={}, **kw)
Configure this widget.
source code
 
__setitem__(self, key, val)
Configure this widget.
source code
 
rowconfigure(self, row_index, cnf={}, **kw)
Configure all table cells in the given row.
source code
 
columnconfigure(self, col_index, cnf={}, **kw)
Configure all table cells in the given column.
source code
 
itemconfigure(self, row_index, col_index, cnf=None, **kw)
Configure the table cell at the given row and column.
source code
 
insert(self, index, *rows)
Insert the given row or rows into the table, at the given index.
source code
 
get(self, first, last=None)
Return the value(s) of the specified row(s).
source code
 
bbox(self, row, col)
Return the bounding box for the given table cell, relative to this widget's top-left corner.
source code
 
hide_column(self, col_index)
Hide the given column.
source code
 
show_column(self, col_index)
Display a column that has been hidden using hide_column().
source code
 
bind_to_labels(self, sequence=None, func=None, add=None)
Add a binding to each Tkinter.Label widget in this mult-column listbox that will call func in response to the event sequence.
source code
 
bind_to_listboxes(self, sequence=None, func=None, add=None)
Add a binding to each Tkinter.Listbox widget in this mult-column listbox that will call func in response to the event sequence.
source code
 
bind_to_columns(self, sequence=None, func=None, add=None)
Add a binding to each Tkinter.Label and Tkinter.Listbox widget in this mult-column listbox that will call func in response to the event sequence.
source code
 
curselection(self, *args, **kwargs) source code
 
selection_includes(self, *args, **kwargs) source code
 
itemcget(self, *args, **kwargs) source code
 
size(self, *args, **kwargs)
Return a tuple of the number of column and rows in the grid.
source code
 
index(self, *args, **kwargs) source code
 
nearest(self, *args, **kwargs) source code
 
activate(self, *args, **kwargs) source code
 
delete(self, *args, **kwargs) source code
 
scan_mark(self, *args, **kwargs) source code
 
scan_dragto(self, *args, **kwargs) source code
 
see(self, *args, **kwargs) source code
 
selection_anchor(self, *args, **kwargs) source code
 
selection_clear(self, *args, **kwargs)
Clear the current X selection.
source code
 
selection_set(self, *args, **kwargs) source code
 
yview(self, *args, **kwargs) source code
 
yview_moveto(self, *args, **kwargs) source code
 
yview_scroll(self, *args, **kwargs) source code
 
itemconfig(self, row_index, col_index, cnf=None, **kw)
Configure the table cell at the given row and column.
source code
 
rowconfig(self, row_index, cnf={}, **kw)
Configure all table cells in the given row.
source code
 
columnconfig(self, col_index, cnf={}, **kw)
Configure all table cells in the given column.
source code
 
select_anchor(self, *args, **kwargs) source code
 
select_clear(self, *args, **kwargs)
Clear the current X selection.
source code
 
select_includes(self, *args, **kwargs) source code
 
select_set(self, *args, **kwargs) source code

Inherited from Tkinter.BaseWidget: destroy

Inherited from Tkinter.BaseWidget (private): _do, _setup

Inherited from Tkinter.Misc: __getitem__, __str__, after, after_cancel, after_idle, bell, bind, bind_all, bind_class, bindtags, cget, clipboard_append, clipboard_clear, clipboard_get, colormodel, config, deletecommand, event_add, event_delete, event_generate, event_info, focus, focus_displayof, focus_force, focus_get, focus_lastfor, focus_set, getboolean, getvar, grab_current, grab_release, grab_set, grab_set_global, grab_status, grid_bbox, grid_columnconfigure, grid_location, grid_propagate, grid_rowconfigure, grid_size, grid_slaves, image_names, image_types, keys, lift, lower, mainloop, nametowidget, option_add, option_clear, option_get, option_readfile, pack_propagate, pack_slaves, place_slaves, propagate, quit, register, selection_get, selection_handle, selection_own, selection_own_get, send, setvar, 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 Tkinter.Misc (private): _bind, _configure, _displayof, _getboolean, _getdoubles, _getints, _grid_configure, _nametowidget, _options, _register, _report_exception, _root, _substitute

Inherited from Tkinter.Pack: forget, info, pack, pack_configure, pack_forget, pack_info

Inherited from Tkinter.Place: place, place_configure, place_forget, place_info

Inherited from Tkinter.Grid: grid, grid_configure, grid_forget, grid_info, grid_remove, location

Class Variables [hide private]
  FRAME_CONFIG = {'background': '#888', 'highlightthickness': 1,...
Default configuration values for the frame.
  LABEL_CONFIG = {'background': '#444', 'borderwidth': 1, 'font'...
Default configurations for the column labels.
  LISTBOX_CONFIG = {'activestyle': 'none', 'borderwidth': 1, 'ex...
Default configuration for the column listboxes.

Inherited from Tkinter.Misc: _noarg_

Inherited from Tkinter.Misc (private): _subst_format, _subst_format_str, _tclCommands

Properties [hide private]
  column_names
A tuple containing the names of the columns used by this multi-column listbox.
  column_labels
A tuple containing the Tkinter.Label widgets used to display the label of each column.
  listboxes
A tuple containing the Tkinter.Listbox widgets used to display individual columns.
Method Details [hide private]

__init__(self, master, columns, column_weights=None, cnf={}, **kw)
(Constructor)

source code 

Construct a new multi-column listbox widget.

Parameters:
  • master - The widget that should contain the new multi-column listbox.
  • columns - Specifies what columns should be included in the new multi-column listbox. If columns is an integer, the it is the number of columns to include. If it is a list, then its length indicates the number of columns to include; and each element of the list will be used as a label for the corresponding column.
  • cnf, kw - Configuration parameters for this widget. Use label_* to configure all labels; and listbox_* to configure all listboxes. E.g.:
    >>> mlb = MultiListbox(master, 5, label_foreground='red')
Overrides: Tkinter.Frame.__init__

_resize_column(self, event)

source code 

Callback used to resize a column of the table. Return True if the column is actually getting resized (if the user clicked on the far left or far right 5 pixels of a label); and False otherwies.

_pagesize(self)

source code 
Returns:
The number of rows that makes up one page

select(self, index=None, delta=None, see=True)

source code 

Set the selected row. If index is specified, then select row index. Otherwise, if delta is specified, then move the current selection by delta (negative numbers for up, positive numbers for down). This will not move the selection past the top or the bottom of the list.

Parameters:
  • see - If true, then call self.see() with the newly selected index, to ensure that it is visible.

configure(self, cnf={}, **kw)

source code 

Configure this widget. Use label_* to configure all labels; and listbox_* to configure all listboxes. E.g.:

>>> mlb = MultiListbox(master, 5)
>>> mlb.configure(label_foreground='red')
>>> mlb.configure(listbox_foreground='red')
Overrides: Tkinter.Misc.configure

__setitem__(self, key, val)
(Index assignment operator)

source code 

Configure this widget. This is equivalent to self.configure({key,val}). See configure().

Overrides: Tkinter.Misc.__setitem__

rowconfigure(self, row_index, cnf={}, **kw)

source code 

Configure all table cells in the given row. Valid keyword arguments are: background, bg, foreground, fg, selectbackground, selectforeground.

Overrides: Tkinter.Misc.grid_rowconfigure

columnconfigure(self, col_index, cnf={}, **kw)

source code 

Configure all table cells in the given column. Valid keyword arguments are: background, bg, foreground, fg, selectbackground, selectforeground.

Overrides: Tkinter.Misc.grid_columnconfigure

itemconfigure(self, row_index, col_index, cnf=None, **kw)

source code 

Configure the table cell at the given row and column. Valid keyword arguments are: background, bg, foreground, fg, selectbackground, selectforeground.

insert(self, index, *rows)

source code 

Insert the given row or rows into the table, at the given index. Each row value should be a tuple of cell values, one for each column in the row. Index may be an integer or any of the special strings (such as 'end') accepted by Tkinter.Listbox.

get(self, first, last=None)

source code 

Return the value(s) of the specified row(s). If last is not specified, then return a single row value; otherwise, return a list of row values. Each row value is a tuple of cell values, one for each column in the row.

bbox(self, row, col)

source code 

Return the bounding box for the given table cell, relative to this widget's top-left corner. The bounding box is a tuple of integers (left, top, width, height).

Overrides: Tkinter.Misc.grid_bbox

hide_column(self, col_index)

source code 

Hide the given column. The column's state is still maintained: its values will still be returned by get(), and you must supply its values when calling insert(). It is safe to call this on a column that is already hidden.

See Also: show_column()

show_column(self, col_index)

source code 

Display a column that has been hidden using hide_column(). It is safe to call this on a column that is not hidden.

bind_to_labels(self, sequence=None, func=None, add=None)

source code 

Add a binding to each Tkinter.Label widget in this mult-column listbox that will call func in response to the event sequence.

Returns:
A list of the identifiers of replaced binding functions (if any), allowing for their deletion (to prevent a memory leak).

bind_to_listboxes(self, sequence=None, func=None, add=None)

source code 

Add a binding to each Tkinter.Listbox widget in this mult-column listbox that will call func in response to the event sequence.

Returns:
A list of the identifiers of replaced binding functions (if any), allowing for their deletion (to prevent a memory leak).

bind_to_columns(self, sequence=None, func=None, add=None)

source code 

Add a binding to each Tkinter.Label and Tkinter.Listbox widget in this mult-column listbox that will call func in response to the event sequence.

Returns:
A list of the identifiers of replaced binding functions (if any), allowing for their deletion (to prevent a memory leak).

size(self, *args, **kwargs)

source code 

Return a tuple of the number of column and rows in the grid.

Overrides: Tkinter.Misc.grid_size
(inherited documentation)

selection_clear(self, *args, **kwargs)

source code 

Clear the current X selection.

Overrides: Tkinter.Misc.selection_clear
(inherited documentation)

itemconfig(self, row_index, col_index, cnf=None, **kw)

source code 

Configure the table cell at the given row and column. Valid keyword arguments are: background, bg, foreground, fg, selectbackground, selectforeground.

rowconfig(self, row_index, cnf={}, **kw)

source code 

Configure all table cells in the given row. Valid keyword arguments are: background, bg, foreground, fg, selectbackground, selectforeground.

columnconfig(self, col_index, cnf={}, **kw)

source code 

Configure all table cells in the given column. Valid keyword arguments are: background, bg, foreground, fg, selectbackground, selectforeground.


Class Variable Details [hide private]

FRAME_CONFIG

Default configuration values for the frame.

Value:
{'background': '#888', 'highlightthickness': 1, 'takefocus': True}

LABEL_CONFIG

Default configurations for the column labels.

Value:
{'background': '#444',
 'borderwidth': 1,
 'font': 'helvetica -16 bold',
 'foreground': 'white',
 'relief': 'raised'}

LISTBOX_CONFIG

Default configuration for the column listboxes.

Value:
{'activestyle': 'none',
 'borderwidth': 1,
 'exportselection': False,
 'highlightthickness': 0,
 'selectbackground': '#888',
 'selectborderwidth': 0,
 'takefocus': False}

Property Details [hide private]

column_names

A tuple containing the names of the columns used by this multi-column listbox.

Get Method:
unreachable(self)

column_labels

A tuple containing the Tkinter.Label widgets used to display the label of each column. If this multi-column listbox was created without labels, then this will be an empty tuple. These widgets will all be augmented with a column_index attribute, which can be used to determine which column they correspond to. This can be convenient, e.g., when defining callbacks for bound events.

Get Method:
unreachable(self)

listboxes

A tuple containing the Tkinter.Listbox widgets used to display individual columns. These widgets will all be augmented with a column_index attribute, which can be used to determine which column they correspond to. This can be convenient, e.g., when defining callbacks for bound events.

Get Method:
unreachable(self)