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

API

class arelle.TkTableWrapper.ArrayVar(master: tkinter.Misc | None = None, name: str | None = 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.

names() Any
get(key: Any = None) Any
set(**kw: Any) None
unset(pattern: str | None = None) None

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

initialize

None

trace_add(mode, callback)
trace_remove(mode, cbname)
trace_info()
trace_variable(mode, callback)
trace

None

trace_vdelete(mode, cbname)
trace_vinfo()
class arelle.TkTableWrapper.Table(master: tkinter.Misc | None = None, **kw: Any)

Bases: tkinter.Widget

Create and manipulate tables.

Initialization

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

activate(index: str | int) None

Set the active cell to the one indicated by index.

bbox(first: str, last: str | None = None) tuple[tuple[str, str], ...]

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: str, first: str | None = None, last: str | None = None) 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: str | None = None, last: str | None = None) None

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

clear_sizes(first: str | None = None, last: str | None = None) 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: str | None = None, last: str | None = None) None

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

clear_all(first: str | None = None, last: str | None = None) None

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

curselection(value: str | None = None) Any

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: str | None = None) Any

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: str | int | None, index2: str | int | None = None) 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: str | int, count: int | None = None, switches: collections.abc.Iterable[str] | None = None) None
delete_rows(index: str | int, count: int | None = None, switches: collections.abc.Iterable[str] | None = None) None
get(first: str, last: str | None = None) Any

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

height(row: int | None = None, **kwargs: Any) int | dict[str, str] | None

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: Any) int

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: str | None = None) int

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: str | int, rc: str | None = None) str | int

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: str | int, value: str) None

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: str | int, count: int | None = None, switches: collections.abc.Iterable[str] | None = None) None
insert_rows(index: str | int, count: int | None = None, switches: collections.abc.Iterable[str] | None = None) None
reread() None

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: int, y: int) None
scan_dragto(x: int, y: int) None
see(index: str | int) None
selection_anchor(index: str | int) None
selection_clear(first: str, last: str | None = None) None
selection_includes(index: str | int) bool
selection_set(first: str, last: str | None = None) None
set(rc: str | None = None, index: str | int | None = None, *args: Any, **kwargs: Any) Any

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: str | int | None = None, **kwargs: Any) Any

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: str, *args: Any) Any
tag_cget(tagname: str, option: str) Any
tag_col(tagname: str, *args: Any) Any
tag_configure(tagname: str, option: str | None = None, **kwargs: Any) Any

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: str) None
tag_exists(tagname: str) bool
tag_includes(tagname: str, index: str | int) bool
tag_lower(tagname: str, belowthis: str | None = None) None
tag_names(pattern: str | None = None) Any
tag_raise(tagname: str, abovethis: str | None = None) None
tag_row(tagname: str, *args: Any) Any
validate(index: str | int) int

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: Any

Return tktable”s package version.

width(column: int | None = None, **kwargs: Any) int | dict[str, str] | None

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: str | int, option: str) Any
window_configure(index: str | int, option: str | None = None, **kwargs: Any) Any

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: str | int) None
window_move(index_from: str | int, index_to: str | int) None
window_names(pattern: str | None = None) Any
xview(index: str | int | None = None) tuple[float, float] | 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: float) None

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: str | int) None

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: str | int | None = None) tuple[float, float] | 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: float) None

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: str | int) None

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() tkinter.Menu
popUpMenu(event: tkinter.Event) None
moveCell(y: int, x: int) None
destroy()
deletecommand(name)
tk_strictMotif(boolean=None)
tk_bisque()
tk_setPalette(*args, **kw)
wait_variable(name='PY_VAR')
waitvar

None

wait_window(window=None)
wait_visibility(window=None)
setvar(name='PY_VAR', value='1')
getvar(name='PY_VAR')
getint(s)
getdouble(s)
getboolean(s)
focus_set()
focus

None

focus_force()
focus_get()
focus_displayof()
focus_lastfor()
tk_focusFollowsMouse()
tk_focusNext()
tk_focusPrev()
after(ms, func=None, *args, **kw)
after_idle(func, *args, **kw)
after_cancel(id)
after_info(id=None)
bell(displayof=0)
tk_busy_cget(option)
busy_cget

None

tk_busy_configure(cnf=None, **kw)
tk_busy_current(pattern=None)
busy_current

None

tk_busy_forget()
busy_forget

None

tk_busy_hold(**kw)
tk_busy_status()
busy_status

None

clipboard_get(**kw)
clipboard_clear(**kw)
clipboard_append(string, **kw)
grab_current()
grab_release()
grab_set()
grab_set_global()
grab_status()
option_add(pattern, value, priority=None)
option_clear()
option_get(name, className)
option_readfile(fileName, priority=None)
selection_get(**kw)
selection_handle(command, **kw)
selection_own(**kw)
selection_own_get(**kw)
send(interp, cmd, *args)
lower(belowThis=None)
tkraise(aboveThis=None)
lift

None

info_patchlevel()
winfo_atom(name, displayof=0)
winfo_atomname(id, displayof=0)
winfo_cells()
winfo_children()
winfo_class()
winfo_colormapfull()
winfo_containing(rootX, rootY, displayof=0)
winfo_depth()
winfo_exists()
winfo_fpixels(number)
winfo_geometry()
winfo_height()
winfo_id()
winfo_interps(displayof=0)
winfo_ismapped()
winfo_manager()
winfo_name()
winfo_parent()
winfo_pathname(id, displayof=0)
winfo_pixels(number)
winfo_pointerx()
winfo_pointerxy()
winfo_pointery()
winfo_reqheight()
winfo_reqwidth()
winfo_rgb(color)
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(includeids=False)
winfo_vrootheight()
winfo_vrootwidth()
winfo_vrootx()
winfo_vrooty()
winfo_width()
winfo_x()
winfo_y()
update()
update_idletasks()
bindtags(tagList=None)
bind(sequence=None, func=None, add=None)
unbind(sequence, funcid=None)
bind_all(sequence=None, func=None, add=None)
unbind_all(sequence)
bind_class(className, sequence=None, func=None, add=None)
unbind_class(className, sequence)
mainloop(n=0)
quit()
nametowidget(name)
register

None

configure(cnf=None, **kw)
config

None

cget(key)
keys()
pack_propagate(flag=_noarg_)
propagate

None

pack_slaves()
slaves

None

place_slaves()
grid_anchor(anchor=None)
anchor

None

grid_bbox(column=None, row=None, col2=None, row2=None)
grid_columnconfigure(index, cnf={}, **kw)
columnconfigure

None

grid_location(x, y)
grid_propagate(flag=_noarg_)
grid_rowconfigure(index, cnf={}, **kw)
rowconfigure

None

grid_size()
size

None

grid_slaves(row=None, column=None)
event_add(virtual, *sequences)
event_delete(virtual, *sequences)
event_generate(sequence, **kw)
event_info(virtual=None)
image_names()
image_types()
pack_configure(cnf={}, **kw)
pack_forget()
forget

None

pack_info()
info

None

place_configure(cnf={}, **kw)
place_forget()
place_info()
grid_configure(cnf={}, **kw)
grid_forget()
grid_remove()
grid_info()
arelle.TkTableWrapper.sample_test() None