desc
stringlengths
3
26.7k
decl
stringlengths
11
7.89k
bodies
stringlengths
8
553k
'Obsolete function, use see.'
def yview_pickplace(self, *what):
self.tk.call(((self._w, 'yview', '-pickplace') + what))
'Construct an optionmenu widget with the parent MASTER, with the resource textvariable set to VARIABLE, the initially selected value VALUE, the other menu values VALUES and an additional keyword argument command.'
def __init__(self, master, variable, value, *values, **kwargs):
kw = {'borderwidth': 2, 'textvariable': variable, 'indicatoron': 1, 'relief': RAISED, 'anchor': 'c', 'highlightthickness': 2} Widget.__init__(self, master, 'menubutton', kw) self.widgetName = 'tk_optionMenu' menu = self.__menu = Menu(self, name='menu', tearoff=0) self.menuname = menu._w callback...
'Destroy this widget and the associated menu.'
def destroy(self):
Menubutton.destroy(self) self.__menu = None return
'Configure the image.'
def configure(self, **kw):
res = () for (k, v) in _cnfmerge(kw).items(): if (v is not None): if (k[(-1)] == '_'): k = k[:(-1)] if hasattr(v, '__call__'): v = self._register(v) res = (res + (('-' + k), v)) self.tk.call(((self.name, 'config') + res)) return...
'Return the height of the image.'
def height(self):
return getint(self.tk.call('image', 'height', self.name))
'Return the type of the imgage, e.g. "photo" or "bitmap".'
def type(self):
return self.tk.call('image', 'type', self.name)
'Return the width of the image.'
def width(self):
return getint(self.tk.call('image', 'width', self.name))
'Create an image with NAME. Valid resource names: data, format, file, gamma, height, palette, width.'
def __init__(self, name=None, cnf={}, master=None, **kw):
Image.__init__(self, 'photo', name, cnf, master, **kw)
'Display a transparent image.'
def blank(self):
self.tk.call(self.name, 'blank')
'Return the value of OPTION.'
def cget(self, option):
return self.tk.call(self.name, 'cget', ('-' + option))
'Return a new PhotoImage with the same image as this widget.'
def copy(self):
destImage = PhotoImage() self.tk.call(destImage, 'copy', self.name) return destImage
'Return a new PhotoImage with the same image as this widget but zoom it with X and Y.'
def zoom(self, x, y=''):
destImage = PhotoImage() if (y == ''): y = x self.tk.call(destImage, 'copy', self.name, '-zoom', x, y) return destImage
'Return a new PhotoImage based on the same image as this widget but use only every Xth or Yth pixel.'
def subsample(self, x, y=''):
destImage = PhotoImage() if (y == ''): y = x self.tk.call(destImage, 'copy', self.name, '-subsample', x, y) return destImage
'Return the color (red, green, blue) of the pixel at X,Y.'
def get(self, x, y):
return self.tk.call(self.name, 'get', x, y)
'Put row formatted colors to image starting from position TO, e.g. image.put("{red green} {blue yellow}", to=(4,6))'
def put(self, data, to=None):
args = (self.name, 'put', data) if to: if (to[0] == '-to'): to = to[1:] args = ((args + ('-to',)) + tuple(to)) self.tk.call(args)
'Write image to file FILENAME in FORMAT starting from position FROM_COORDS.'
def write(self, filename, format=None, from_coords=None):
args = (self.name, 'write', filename) if format: args = (args + ('-format', format)) if from_coords: args = ((args + ('-from',)) + tuple(from_coords)) self.tk.call(args)
'Create a bitmap with NAME. Valid resource names: background, data, file, foreground, maskdata, maskfile.'
def __init__(self, name=None, cnf={}, master=None, **kw):
Image.__init__(self, 'bitmap', name, cnf, master, **kw)
'Construct a spinbox widget with the parent MASTER. STANDARD OPTIONS activebackground, background, borderwidth, cursor, exportselection, font, foreground, highlightbackground, highlightcolor, highlightthickness, insertbackground, insertborderwidth, insertofftime, insertontime, insertwidth, justify, relief, repeatdelay,...
def __init__(self, master=None, cnf={}, **kw):
Widget.__init__(self, master, 'spinbox', cnf, kw)
'Return a tuple of X1,Y1,X2,Y2 coordinates for a rectangle which encloses the character given by index. The first two elements of the list give the x and y coordinates of the upper-left corner of the screen area covered by the character (in pixels relative to the widget) and the last two elements give the width and hei...
def bbox(self, index):
return self.tk.call(self._w, 'bbox', index)
'Delete one or more elements of the spinbox. First is the index of the first character to delete, and last is the index of the character just after the last one to delete. If last isn\'t specified it defaults to first+1, i.e. a single character is deleted. This command returns an empty string.'
def delete(self, first, last=None):
return self.tk.call(self._w, 'delete', first, last)
'Returns the spinbox\'s string'
def get(self):
return self.tk.call(self._w, 'get')
'Alter the position of the insertion cursor. The insertion cursor will be displayed just before the character given by index. Returns an empty string'
def icursor(self, index):
return self.tk.call(self._w, 'icursor', index)
'Returns the name of the widget at position x, y Return value is one of: none, buttondown, buttonup, entry'
def identify(self, x, y):
return self.tk.call(self._w, 'identify', x, y)
'Returns the numerical index corresponding to index'
def index(self, index):
return self.tk.call(self._w, 'index', index)
'Insert string s at index Returns an empty string.'
def insert(self, index, s):
return self.tk.call(self._w, 'insert', index, s)
'Causes the specified element to be invoked The element could be buttondown or buttonup triggering the action associated with it.'
def invoke(self, element):
return self.tk.call(self._w, 'invoke', element)
'Internal function.'
def scan(self, *args):
return (self._getints(self.tk.call(((self._w, 'scan') + args))) or ())
'Records x and the current view in the spinbox window; used in conjunction with later scan dragto commands. Typically this command is associated with a mouse button press in the widget. It returns an empty string.'
def scan_mark(self, x):
return self.scan('mark', x)
'Compute the difference between the given x argument and the x argument to the last scan mark command It then adjusts the view left or right by 10 times the difference in x-coordinates. This command is typically associated with mouse motion events in the widget, to produce the effect of dragging the spinbox at high spe...
def scan_dragto(self, x):
return self.scan('dragto', x)
'Internal function.'
def selection(self, *args):
return (self._getints(self.tk.call(((self._w, 'selection') + args))) or ())
'Locate the end of the selection nearest to the character given by index, Then adjust that end of the selection to be at index (i.e including but not going beyond index). The other end of the selection is made the anchor point for future select to commands. If the selection isn\'t currently in the spinbox, then a new s...
def selection_adjust(self, index):
return self.selection('adjust', index)
'Clear the selection If the selection isn\'t in this widget then the command has no effect. Returns an empty string.'
def selection_clear(self):
return self.selection('clear')
'Sets or gets the currently selected element. If a spinbutton element is specified, it will be displayed depressed'
def selection_element(self, element=None):
return self.selection('element', element)
'Construct a labelframe widget with the parent MASTER. STANDARD OPTIONS borderwidth, cursor, font, foreground, highlightbackground, highlightcolor, highlightthickness, padx, pady, relief, takefocus, text WIDGET-SPECIFIC OPTIONS background, class, colormap, container, height, labelanchor, labelwidget, visual, width'
def __init__(self, master=None, cnf={}, **kw):
Widget.__init__(self, master, 'labelframe', cnf, kw)
'Construct a panedwindow widget with the parent MASTER. STANDARD OPTIONS background, borderwidth, cursor, height, orient, relief, width WIDGET-SPECIFIC OPTIONS handlepad, handlesize, opaqueresize, sashcursor, sashpad, sashrelief, sashwidth, showhandle,'
def __init__(self, master=None, cnf={}, **kw):
Widget.__init__(self, master, 'panedwindow', cnf, kw)
'Add a child widget to the panedwindow in a new pane. The child argument is the name of the child widget followed by pairs of arguments that specify how to manage the windows. The possible options and values are the ones accepted by the paneconfigure method.'
def add(self, child, **kw):
self.tk.call(((self._w, 'add', child) + self._options(kw)))
'Remove the pane containing child from the panedwindow All geometry management options for child will be forgotten.'
def remove(self, child):
self.tk.call(self._w, 'forget', child)
'Identify the panedwindow component at point x, y If the point is over a sash or a sash handle, the result is a two element list containing the index of the sash or handle, and a word indicating whether it is over a sash or a handle, such as {0 sash} or {2 handle}. If the point is over any other part of the panedwindow...
def identify(self, x, y):
return self.tk.call(self._w, 'identify', x, y)
'Internal function.'
def proxy(self, *args):
return (self._getints(self.tk.call(((self._w, 'proxy') + args))) or ())
'Return the x and y pair of the most recent proxy location'
def proxy_coord(self):
return self.proxy('coord')
'Remove the proxy from the display.'
def proxy_forget(self):
return self.proxy('forget')
'Place the proxy at the given x and y coordinates.'
def proxy_place(self, x, y):
return self.proxy('place', x, y)
'Internal function.'
def sash(self, *args):
return (self._getints(self.tk.call(((self._w, 'sash') + args))) or ())
'Return the current x and y pair for the sash given by index. Index must be an integer between 0 and 1 less than the number of panes in the panedwindow. The coordinates given are those of the top left corner of the region containing the sash. pathName sash dragto index x y This command computes the difference between t...
def sash_coord(self, index):
return self.sash('coord', index)
'Records x and y for the sash given by index; Used in conjunction with later dragto commands to move the sash.'
def sash_mark(self, index):
return self.sash('mark', index)
'Place the sash given by index at the given coordinates'
def sash_place(self, index, x, y):
return self.sash('place', index, x, y)
'Query a management option for window. Option may be any value allowed by the paneconfigure subcommand'
def panecget(self, child, option):
return self.tk.call(((self._w, 'panecget') + (child, ('-' + option))))
'Query or modify the management options for window. If no option is specified, returns a list describing all of the available options for pathName. If option is specified with no value, then the command returns a list describing the one named option (this list will be identical to the corresponding sublist of the valu...
def paneconfigure(self, tagOrId, cnf=None, **kw):
if ((cnf is None) and (not kw)): cnf = {} for x in self.tk.split(self.tk.call(self._w, 'paneconfigure', tagOrId)): cnf[x[0][1:]] = ((x[0][1:],) + x[1:]) return cnf else: if ((type(cnf) == StringType) and (not kw)): x = self.tk.split(self.tk.call(self._w, '...
'Returns an ordered list of the child panes.'
def panes(self):
return self.tk.call(self._w, 'panes')
'Tix maintains a list of directories under which the tix_getimage and tix_getbitmap commands will search for image files. The standard bitmap directory is $TIX_LIBRARY/bitmaps. The addbitmapdir command adds directory into this list. By using this command, the image files of an applications can also be located u...
def tix_addbitmapdir(self, directory):
return self.tk.call('tix', 'addbitmapdir', directory)
'Returns the current value of the configuration option given by option. Option may be any of the options described in the CONFIGURATION OPTIONS section.'
def tix_cget(self, option):
return self.tk.call('tix', 'cget', option)
'Query or modify the configuration options of the Tix application context. If no option is specified, returns a dictionary all of the available options. If option is specified with no value, then the command returns a list describing the one named option (this list will be identical to the corresponding sublist of the...
def tix_configure(self, cnf=None, **kw):
if kw: cnf = _cnfmerge((cnf, kw)) elif cnf: cnf = _cnfmerge(cnf) if (cnf is None): cnf = {} for x in self.tk.split(self.tk.call('tix', 'configure')): cnf[x[0][1:]] = ((x[0][1:],) + x[1:]) return cnf else: if isinstance(cnf, StringType): ...
'Returns the file selection dialog that may be shared among different calls from this application. This command will create a file selection dialog widget when it is called the first time. This dialog will be returned by all subsequent calls to tix_filedialog. An optional dlgclass parameter can be passed to specified ...
def tix_filedialog(self, dlgclass=None):
if (dlgclass is not None): return self.tk.call('tix', 'filedialog', dlgclass) else: return self.tk.call('tix', 'filedialog') return
'Locates a bitmap file of the name name.xpm or name in one of the bitmap directories (see the tix_addbitmapdir command above). By using tix_getbitmap, you can avoid hard coding the pathnames of the bitmap files in your application. When successful, it returns the complete pathname of the bitmap file, prefixed with the...
def tix_getbitmap(self, name):
return self.tk.call('tix', 'getbitmap', name)
'Locates an image file of the name name.xpm, name.xbm or name.ppm in one of the bitmap directories (see the addbitmapdir command above). If more than one file with the same name (but different extensions) exist, then the image type is chosen according to the depth of the X display: xbm images are chosen on monochrome d...
def tix_getimage(self, name):
return self.tk.call('tix', 'getimage', name)
'Gets the options maintained by the Tix scheme mechanism. Available options include: active_bg active_fg bg bold_font dark1_bg dark1_fg dark2_bg dark2_fg disabled_fg fg fixed_font font inactive_bg inactive_fg input1_bg input2_bg italic_font light...
def tix_option_get(self, name):
return self.tk.call('tix', 'option', 'get', name)
'Resets the scheme and fontset of the Tix application to newScheme and newFontSet, respectively. This affects only those widgets created after this call. Therefore, it is best to call the resetoptions command before the creation of any widgets in a Tix application. The optional parameter newScmPrio can be given to res...
def tix_resetoptions(self, newScheme, newFontSet, newScmPrio=None):
if (newScmPrio is not None): return self.tk.call('tix', 'resetoptions', newScheme, newFontSet, newScmPrio) else: return self.tk.call('tix', 'resetoptions', newScheme, newFontSet) return
'Set a variable without calling its action routine'
def set_silent(self, value):
self.tk.call('tixSetSilent', self._w, value)
'Return the named subwidget (which must have been created by the sub-class).'
def subwidget(self, name):
n = self._subwidget_name(name) if (not n): raise TclError, ((('Subwidget ' + name) + ' not child of ') + self._name) n = n[(len(self._w) + 1):] return self._nametowidget(n)
'Return all subwidgets.'
def subwidgets_all(self):
names = self._subwidget_names() if (not names): return [] retlist = [] for name in names: name = name[(len(self._w) + 1):] try: retlist.append(self._nametowidget(name)) except: pass return retlist
'Get a subwidget name (returns a String, not a Widget !)'
def _subwidget_name(self, name):
try: return self.tk.call(self._w, 'subwidget', name) except TclError: return None return None
'Return the name of all subwidgets.'
def _subwidget_names(self):
try: x = self.tk.call(self._w, 'subwidgets', '-all') return self.tk.split(x) except TclError: return None return None
'Set configuration options for all subwidgets (and self).'
def config_all(self, option, value):
if (option == ''): return if (not isinstance(option, StringType)): option = repr(option) if (not isinstance(value, StringType)): value = repr(value) names = self._subwidget_names() for name in names: self.tk.call(name, 'configure', ('-' + option), value)
'Bind balloon widget to another. One balloon widget may be bound to several widgets at the same time'
def bind_widget(self, widget, cnf={}, **kw):
self.tk.call(self._w, 'bind', widget._w, *self._options(cnf, kw))
'Add a button with given name to box.'
def add(self, name, cnf={}, **kw):
btn = self.tk.call(self._w, 'add', name, *self._options(cnf, kw)) self.subwidget_list[name] = _dummyButton(self, name) return btn
'This command calls the setmode method for all the entries in this Tree widget: if an entry has no child entries, its mode is set to none. Otherwise, if the entry has any hidden child entries, its mode is set to open; otherwise its mode is set to close.'
def autosetmode(self):
self.tk.call(self._w, 'autosetmode')
'Close the entry given by entryPath if its mode is close.'
def close(self, entrypath):
self.tk.call(self._w, 'close', entrypath)
'Returns the current mode of the entry given by entryPath.'
def getmode(self, entrypath):
return self.tk.call(self._w, 'getmode', entrypath)
'Open the entry given by entryPath if its mode is open.'
def open(self, entrypath):
self.tk.call(self._w, 'open', entrypath)
'This command is used to indicate whether the entry given by entryPath has children entries and whether the children are visible. mode must be one of open, close or none. If mode is set to open, a (+) indicator is drawn next to the entry. If mode is set to close, a (-) indicator is drawn next to the entry. If mode is s...
def setmode(self, entrypath, mode='none'):
self.tk.call(self._w, 'setmode', entrypath, mode)
'This command calls the setmode method for all the entries in this Tree widget: if an entry has no child entries, its mode is set to none. Otherwise, if the entry has any hidden child entries, its mode is set to open; otherwise its mode is set to close.'
def autosetmode(self):
self.tk.call(self._w, 'autosetmode')
'Close the entry given by entryPath if its mode is close.'
def close(self, entrypath):
self.tk.call(self._w, 'close', entrypath)
'Returns the current mode of the entry given by entryPath.'
def getmode(self, entrypath):
return self.tk.call(self._w, 'getmode', entrypath)
'Open the entry given by entryPath if its mode is open.'
def open(self, entrypath):
self.tk.call(self._w, 'open', entrypath)
'Returns a list of items whose status matches status. If status is not specified, the list of items in the "on" status will be returned. Mode can be on, off, default'
def getselection(self, mode='on'):
c = self.tk.split(self.tk.call(self._w, 'getselection', mode)) return self.tk.splitlist(c)
'Returns the current status of entryPath.'
def getstatus(self, entrypath):
return self.tk.call(self._w, 'getstatus', entrypath)
'Sets the status of entryPath to be status. A bitmap will be displayed next to the entry its status is on, off or default.'
def setstatus(self, entrypath, mode='on'):
self.tk.call(self._w, 'setstatus', entrypath, mode)
'Removes the selection anchor.'
def anchor_clear(self):
self.tk.call(self, 'anchor', 'clear')
'Get the (x,y) coordinate of the current anchor cell'
def anchor_get(self):
return self._getints(self.tk.call(self, 'anchor', 'get'))
'Set the selection anchor to the cell at (x, y).'
def anchor_set(self, x, y):
self.tk.call(self, 'anchor', 'set', x, y)
'Delete rows between from_ and to inclusive. If to is not provided, delete only row at from_'
def delete_row(self, from_, to=None):
if (to is None): self.tk.call(self, 'delete', 'row', from_) else: self.tk.call(self, 'delete', 'row', from_, to) return
'Delete columns between from_ and to inclusive. If to is not provided, delete only column at from_'
def delete_column(self, from_, to=None):
if (to is None): self.tk.call(self, 'delete', 'column', from_) else: self.tk.call(self, 'delete', 'column', from_, to) return
'If any cell is being edited, de-highlight the cell and applies the changes.'
def edit_apply(self):
self.tk.call(self, 'edit', 'apply')
'Highlights the cell at (x, y) for editing, if the -editnotify command returns True for this cell.'
def edit_set(self, x, y):
self.tk.call(self, 'edit', 'set', x, y)
'Get the option value for cell at (x,y)'
def entrycget(self, x, y, option):
if (option and (option[0] != '-')): option = ('-' + option) return self.tk.call(self, 'entrycget', x, y, option)
'Return True if display item exists at (x,y)'
def info_exists(self, x, y):
return self._getboolean(self.tk.call(self, 'info', 'exists', x, y))
'Moves the the range of columns from position FROM through TO by the distance indicated by OFFSET. For example, move_column(2, 4, 1) moves the columns 2,3,4 to columns 3,4,5.'
def move_column(self, from_, to, offset):
self.tk.call(self, 'move', 'column', from_, to, offset)
'Moves the the range of rows from position FROM through TO by the distance indicated by OFFSET. For example, move_row(2, 4, 1) moves the rows 2,3,4 to rows 3,4,5.'
def move_row(self, from_, to, offset):
self.tk.call(self, 'move', 'row', from_, to, offset)
'Return coordinate of cell nearest pixel coordinate (x,y)'
def nearest(self, x, y):
return self._getints(self.tk.call(self, 'nearest', x, y))
'Queries or sets the size of the column given by INDEX. INDEX may be any non-negative integer that gives the position of a given column. INDEX can also be the string "default"; in this case, this command queries or sets the default size of all columns. When no option-value pair is given, this command return...
def size_column(self, index, **kw):
return self.tk.split(self.tk.call(self._w, 'size', 'column', index, *self._options({}, kw)))
'Queries or sets the size of the row given by INDEX. INDEX may be any non-negative integer that gives the position of a given row . INDEX can also be the string "default"; in this case, this command queries or sets the default size of all rows. When no option-value pair is given, this command returns a list co...
def size_row(self, index, **kw):
return self.tk.split(self.tk.call(self, 'size', 'row', index, *self._options({}, kw)))
'Clears the cell at (x, y) by removing its display item.'
def unset(self, x, y):
self.tk.call(self._w, 'unset', x, y)
'Query or sets the default value of the specified option(s) in style. Each key in kw is an option and each value is either a string or a sequence identifying the value for that option.'
def configure(self, style, query_opt=None, **kw):
if (query_opt is not None): kw[query_opt] = None return _val_or_dict(kw, self.tk.call, self._name, 'configure', style)
'Query or sets dynamic values of the specified option(s) in style. Each key in kw is an option and each value should be a list or a tuple (usually) containing statespecs grouped in tuples, or list, or something else of your preference. A statespec is compound of one or more states and then a value.'
def map(self, style, query_opt=None, **kw):
if (query_opt is not None): return _list_from_statespec(self.tk.call(self._name, 'map', style, ('-%s' % query_opt))) else: return _dict_from_tcltuple(self.tk.call(self._name, 'map', style, *_format_mapdict(kw)))
'Returns the value specified for option in style. If state is specified it is expected to be a sequence of one or more states. If the default argument is set, it is used as a fallback value in case no specification for option is found.'
def lookup(self, style, option, state=None, default=None):
state = (' '.join(state) if state else '') return self.tk.call(self._name, 'lookup', style, ('-%s' % option), state, default)
'Define the widget layout for given style. If layoutspec is omitted, return the layout specification for given style. layoutspec is expected to be a list or an object different than None that evaluates to False if you want to "turn off" that style. If it is a list (or tuple, or something else), each item should be a tu...
def layout(self, style, layoutspec=None):
lspec = None if layoutspec: lspec = _format_layoutlist(layoutspec)[0] elif (layoutspec is not None): lspec = 'null' return _list_from_layouttuple(self.tk.call(self._name, 'layout', style, lspec))
'Create a new element in the current theme of given etype.'
def element_create(self, elementname, etype, *args, **kw):
(spec, opts) = _format_elemcreate(etype, False, *args, **kw) self.tk.call(self._name, 'element', 'create', elementname, etype, spec, *opts)
'Returns the list of elements defined in the current theme.'
def element_names(self):
return self.tk.call(self._name, 'element', 'names')
'Return the list of elementname\'s options.'
def element_options(self, elementname):
return self.tk.call(self._name, 'element', 'options', elementname)
'Creates a new theme. It is an error if themename already exists. If parent is specified, the new theme will inherit styles, elements and layouts from the specified parent theme. If settings are present, they are expected to have the same syntax used for theme_settings.'
def theme_create(self, themename, parent=None, settings=None):
script = (_script_from_settings(settings) if settings else '') if parent: self.tk.call(self._name, 'theme', 'create', themename, '-parent', parent, '-settings', script) else: self.tk.call(self._name, 'theme', 'create', themename, '-settings', script)