arelle.TkTableWrapper#

This contains a wrapper class for the tktable widget as well a class for using tcl arrays that are, in some instances, required by tktable.

Module Contents#

Classes#

ArrayVar

Class for handling Tcl arrays.

Table

Create and manipulate tables.

Functions#

Data#

API#

arelle.TkTableWrapper.__author__#

‘Guilherme Polo ggpolo@gmail.com

arelle.TkTableWrapper.__all__#

[‘ArrayVar’, ‘Table’]

arelle.TkTableWrapper._setup_master(master)#
class arelle.TkTableWrapper.ArrayVar(master=None, name=None)#

Bases: tkinter.Variable

Class for handling Tcl arrays.

An array is actually an associative array in Tcl, so this class supports some dict operations.

Initialization

Construct a variable

MASTER can be given as master widget. VALUE is an optional value (defaults to “”) NAME is an optional Tcl name (defaults to PY_VARnum).

If NAME matches an existing variable and VALUE is omitted then the existing value is retained.

__del__()#
__len__()#
__getitem__(key)#
__setitem__(key, value)#
names()#
get(key=None)#
set(**kw)#
unset(pattern=None)#

Unsets all of the elements in the array. If pattern is given, only the elements that match pattern are unset.

arelle.TkTableWrapper._TKTABLE_LOADED#

False

class arelle.TkTableWrapper.Table(master=None, **kw)#

Bases: tkinter.Widget

Create and manipulate tables.

Initialization

Construct a widget with the parent widget MASTER, a name WIDGETNAME and appropriate options.

_switches#

(‘holddimensions’, ‘holdselection’, ‘holdtags’, ‘holdwindows’, ‘keeptitles’, ‘-‘)

_tabsubst_format#

(‘%c’, ‘%C’, ‘%i’, ‘%r’, ‘%s’, ‘%S’, ‘%W’)

_tabsubst_commands#

(‘browsecommand’, ‘browsecmd’, ‘command’, ‘selectioncommand’, ‘selcmd’, ‘validatecommand’, ‘valcmd’)

_options(cnf, kw=None)#
_tabsubst(*args)#
_handle_switches(args)#
activate(index)#

Set the active cell to the one indicated by index.

bbox(first, last=None)#

Return the bounding box for the specified cell (range) as a 4-tuple of x, y, width and height in pixels. It clips the box to the visible portion, if any, otherwise an empty tuple is returned.

clear(option, first=None, last=None)#

This is a convenience routine to clear certain state information managed by the table. first and last represent valid table indices. If neither are specified, then the command operates on the whole table.

clear_cache(first=None, last=None)#

Clear the specified section of the cache, if the table has been keeping one.

clear_sizes(first=None, last=None)#

Clear the specified row and column areas of specific height/width dimensions. When just one index is specified, for example 2,0, that is interpreted as row 2 and column 0.

clear_tags(first=None, last=None)#

Clear the specified area of tags (all row, column and cell tags).

clear_all(first=None, last=None)#

Perform all of the above clear functions on the specified area.

curselection(value=None)#

With no arguments, it returns the sorted indices of the currently selected cells. Otherwise it sets all the selected cells to the given value if there is an associated ArrayVar and the state is not disabled.

curvalue(value=None)#

If no value is given, the value of the cell being edited (indexed by active) is returned, else it is set to the given value.

delete_active(index1, index2=None)#

Deletes text from the active cell. If only one index is given, it deletes the character after that index, otherwise it deletes from the first index to the second. index can be a number, insert or end.

delete_cols(index, count=None, switches=None)#
delete_rows(index, count=None, switches=None)#
get(first, last=None)#

Returns the value of the cells specified by the table indices first and (optionally) last.

height(row=None, **kwargs)#

If row and kwargs are not given, a list describing all rows for which a width has been set is returned. If row is given, the height of that row is returnd. If kwargs is given, then it sets the key/value pairs, where key is a row and value represents the height for the row.

hidden(*args)#

When called without args, it returns all the hidden cells (those cells covered by a spanning cell). If one index is specified, it returns the spanning cell covering that index, if any. If multiple indices are specified, it returns 1 if all indices are hidden cells, 0 otherwise.

icursor(arg=None)#

If arg is not specified, return the location of the insertion cursor in the active cell. Otherwise, set the cursor to that point in the string.

0 is before the first character, you can also use insert or end for the current insertion point or the end of the text. If there is no active cell, or the cell or table is disabled, this will return -1.

index(index, rc=None)#

Return the integer cell coordinate that corresponds to index in the form row, col. If rc is specified, it must be either ‘row’ or ‘col’ so only the row or column index is returned.

insert_active(index, value)#

The value is a text string which is inserted at the index postion of the active cell. The cursor is then positioned after the new text. index can be a number, insert or end.

insert_cols(index, count=None, switches=None)#
insert_rows(index, count=None, switches=None)#
reread()#

Rereads the old contents of the cell back into the editing buffer. Useful for a key binding when is pressed to abort the edit (a default binding).

scan_mark(x, y)#
scan_dragto(x, y)#
see(index)#
selection_anchor(index)#
selection_clear(first, last=None)#
selection_includes(index)#
selection_set(first, last=None)#
set(rc=None, index=None, *args, **kwargs)#

If rc is specified (either ‘row’ or ‘col’) then it is assumes that args (if given) represents values which will be set into the subsequent columns (if row is specified) or rows (for col). If index is not None and args is not given, then it will return the value(s) for the cell(s) specified.

If kwargs is given, assumes that each key in kwargs is a index in this table and sets the specified index to the associated value. Table validation will not be triggered via this method.

Note that the table must have an associated array (defined through the variable option) in order to this work.

spans(index=None, **kwargs)#

Manipulate row/col spans.

When called with no arguments, all known spans are returned as a dict. When called with only the index, the span for that index only is returned, if any. Otherwise kwargs is assumed to contain keys/values pairs used to set spans. A span starts at the row,col defined by a key and continues for the specified number of rows,cols specified by its value. A span of 0,0 unsets any span on that cell.

tag_cell(tagname, *args)#
tag_cget(tagname, option)#
tag_col(tagname, *args)#
tag_configure(tagname, option=None, **kwargs)#

Query or modify options associated with the tag given by tagname.

If no option is specified, a dict describing all of the available options for tagname is returned. If option is specified, then the command returns a list describing the one named option. Lastly, if kwargs is given then it corresponds to option-value pairs that should be modified.

tag_delete(tagname)#
tag_exists(tagname)#
tag_includes(tagname, index)#
tag_lower(tagname, belowthis=None)#
tag_names(pattern=None)#
tag_raise(tagname, abovethis=None)#
tag_row(tagname, *args)#
validate(index)#

Explicitly validates the specified index based on the current callback set for the validatecommand option. Return 0 or 1 based on whether the cell was validated.

property version#

Return tktable’s package version.

width(column=None, **kwargs)#

If column and kwargs are not given, a dict describing all columns for which a width has been set is returned. If column is given, the width of that column is returnd. If kwargs is given, then it sets the key/value pairs, where key is a column and value represents the width for the column.

window_cget(index, option)#
window_configure(index, option=None, **kwargs)#

Query or modify options associated with the embedded window given by index. This should also be used to add a new embedded window into the table.

If no option is specified, a dict describing all of the available options for index is returned. If option is specified, then the command returns a list describing the one named option. Lastly, if kwargs is given then it corresponds to option-value pairs that should be modified.

window_delete(*indexes)#
window_move(index_from, index_to)#
window_names(pattern=None)#
xview(index=None)#

If index is not given a tuple containing two fractions is returned, each fraction is between 0 and 1. Together they describe the horizontal span that is visible in the window.

If index is given the view in the window is adjusted so that the column given by index is displayed at the left edge of the window.

xview_moveto(fraction)#

Adjusts the view in the window so that fraction of the total width of the table text is off-screen to the left. The fraction parameter must be a fraction between 0 and 1.

xview_scroll(*L)#

Shift the view in the window left or right according to number and what. The ‘number’ parameter must be an integer. The ‘what’ parameter must be either units or pages or an abbreviation of one of these.

If ‘what’ is units, the view adjusts left or right by number cells on the display; if it is pages then the view adjusts by number screenfuls. If ‘number’ is negative then cells farther to the left become visible; if it is positive then cells farther to the right become visible.

yview(index=None)#

If index is not given a tuple containing two fractions is returned, each fraction is between 0 and 1. The first element gives the position of the table element at the top of the window, relative to the table as a whole. The second element gives the position of the table element just after the last one in the window, relative to the table as a whole.

If index is given the view in the window is adjusted so that the row given by index is displayed at the top of the window.

yview_moveto(fraction)#

Adjusts the view in the window so that the element given by fraction appears at the top of the window. The fraction parameter must be a fraction between 0 and 1.

yview_scroll(*L)#

Adjust the view in the window up or down according to number and what. The ‘number’ parameter must be an integer. The ‘what’ parameter must be either units or pages or an abbreviation of one of these.

If ‘what’ is units, the view adjusts up or down by number cells; if it is pages then the view adjusts by number screenfuls. If ‘number’ is negative then earlier elements become visible; if it is positive then later elements become visible.

contextMenu()#
popUpMenu(event)#
moveCell(y, x)#
arelle.TkTableWrapper.sample_test()#