| |
- Treectrl.Treectrl(Tkinter.Widget)
-
- MultiListbox
class MultiListbox(Treectrl.Treectrl) |
|
A flexible multi column listbox widget for Tkinter.
Based on the Treectrl widget, it offers the following additional configuration options:
columns - a sequence of strings that defines the number of columns of the widget.
The strings will be used in the columnheader lines (default: (' ',)).
command - an optional command that will be executed when the user double-clicks
into the listbox or presses the Return key. The listbox index of the item
that was clicked on resp. of the currently active item is passed as argument
to the callback; if there is no item at the event coordinates resp.
no active item exists, this index will be -1 (default: None).
expandcolumns - a sequence of integers defining the columns that should expand
horizontally beyond the requested size when the widget is resized
(note that the rightmost column will always expand) (default: ()).
selectcmd - an optional callback that will be executed when the selection of the
listbox changes. A tuple containing the indices of the currently
selected items as returned by curselection() will be passed to the
callback (default: None).
selectbackground - the background color to use for the selection rectangle (default: #00008B).
selectforeground - the foreground color to use for selected text (default: white).
By default, the widget uses one pre-defined style for all columns; the widget's style()
method allows to access and configure the default style, as well as applying new
user-defined styles per column.
The default style defines two elements, "text" and "select" (which describes attributes
of the selection rectangle); these may be accessed and configured with the element() method.
Conversion between listbox indices and treectrl item descriptors can be done with the item()
and index() widget methods.
Besides this, most common operations can be done with methods identical or very similar to
those of a Tkinter.Listbox, with the exception of the selection_xxx() methods, where
the treectrl methods are kept intact; for Tkinter.Listbox alike methods, use select_xxx(). |
|
Methods defined here:
- __getitem__ = cget(self, key)
- __init__(self, master=None, columns=(' ',), selectcmd=None, command=None, expandcolumns=(), showroot=0, selectforeground='white', selectbackground='#00008B', **kw)
- activate(self, index)
- Like Tkinter.Listbox.activate(). Note that this overrides the activate()
method inherited from Treectrl.
- bbox(self, index, column=None, element=None)
- Like item_bbox(), except that it requires a listbox index instead
of a treectrl item descriptor as argument. Note that this overrides the
bbox() method inherited from Treectrl.
- cget(self, key)
- column(self, index)
- Return the column identifier for the column at INDEX.
- config = configure(self, cnf=None, **kw)
- configure(self, cnf=None, **kw)
- curselection(self)
- Like Tkinter.Listbox.curselection().
- delete(self, first, last=None)
- Like Tkinter.Listbox.delete() except that an additional index descriptor
ALL may be used, so that delete(ALL) is equivalent with delete(0, END).
- element(self, element)
- Return the treectrl element corresponding to ELEMENT.
ELEMENT may be "text" or "select".
- get(self, first, last=None)
- Like Tkinter.Listbox.get(), except that each element of the returned tuple
is a tuple instead of a string; each of these tuples contains the text strings
per column of a listbox item.
- index(self, which=None, item=None)
- Like Tkinter.Listbox.index(), except that if ITEM is specified, the
listbox index for the treectrl item descriptor ITEM is returned.
- insert(self, index, *args)
- Similar to Tkinter.Listbox.insert(), except that instead of one string
a number of strings equal to the number of columns must be given as arguments.
It is an error to specify more or fewer arguments than the number of columns.
- item(self, index)
- Return the treectrl item descriptor for the item at INDEX.
- keys(self)
- nearest(self, y)
- Like Tkinter.Listbox.nearest().
- numcolumns(self)
- Return the number of listbox columns.
- see(self, index)
- Like Tkinter.Listbox.see(). Note that this overrides the
see() method inherited from Treectrl.
- select_anchor(self, index=None)
- Like Tkinter.Listbox.select_anchor(), except that it if no INDEX is specified
the current selection anchor will be returned.
- select_clear(self, first=None, last=None)
- Like Tkinter.Listbox.select_clear(), except that if no arguments are
specified, all items will be deleted, so that select_clear() is equivalent
with select-clear(0, END).
- select_includes(self, index)
- Like Tkinter.Listbox.select_includes().
- select_set(self, first, last=None)
- Like Tkinter.Listbox.select_set().
- size(self)
- Like Tkinter.Listbox.size().
- sort(self, column=None, element=None, first=None, last=None, mode=None, command=None, notreally=0)
- Like item_sort(), except that the item descriptor defaults to ROOT
(which is most likely wanted) and that the FIRST and LAST options require
listbox indices instead of treectrl item descriptors.
- style(self, index, newstyle=None)
- If NEWSTYLE is specified, set the style for the column at INDEX to NEWSTYLE.
Return the style identifier for the column at INDEX.
| |