desc
stringlengths 3
26.7k
| decl
stringlengths 11
7.89k
| bodies
stringlengths 8
553k
|
---|---|---|
'Return the y-position of the topmost pixel of the menu item at INDEX.'
| def yposition(self, index):
| return getint(self.tk.call(self._w, 'yposition', index))
|
'Construct a radiobutton widget with the parent MASTER.
Valid resource names: activebackground, activeforeground, anchor,
background, bd, bg, bitmap, borderwidth, command, cursor,
disabledforeground, fg, font, foreground, height,
highlightbackground, highlightcolor, highlightthickness, image,
indicatoron, justify, padx, pady, relief, selectcolor, selectimage,
state, takefocus, text, textvariable, underline, value, variable,
width, wraplength.'
| def __init__(self, master=None, cnf={}, **kw):
| Widget.__init__(self, master, 'radiobutton', cnf, kw)
|
'Put the button in off-state.'
| def deselect(self):
| self.tk.call(self._w, 'deselect')
|
'Flash the button.'
| def flash(self):
| self.tk.call(self._w, 'flash')
|
'Toggle the button and invoke a command if given as resource.'
| def invoke(self):
| return self.tk.call(self._w, 'invoke')
|
'Put the button in on-state.'
| def select(self):
| self.tk.call(self._w, 'select')
|
'Construct a scale widget with the parent MASTER.
Valid resource names: activebackground, background, bigincrement, bd,
bg, borderwidth, command, cursor, digits, fg, font, foreground, from,
highlightbackground, highlightcolor, highlightthickness, label,
length, orient, relief, repeatdelay, repeatinterval, resolution,
showvalue, sliderlength, sliderrelief, state, takefocus,
tickinterval, to, troughcolor, variable, width.'
| def __init__(self, master=None, cnf={}, **kw):
| Widget.__init__(self, master, 'scale', cnf, kw)
|
'Get the current value as integer or float.'
| def get(self):
| value = self.tk.call(self._w, 'get')
try:
return getint(value)
except ValueError:
return getdouble(value)
|
'Set the value to VALUE.'
| def set(self, value):
| self.tk.call(self._w, 'set', value)
|
'Return a tuple (X,Y) of the point along the centerline of the
trough that corresponds to VALUE or the current value if None is
given.'
| def coords(self, value=None):
| return self._getints(self.tk.call(self._w, 'coords', value))
|
'Return where the point X,Y lies. Valid return values are "slider",
"though1" and "though2".'
| def identify(self, x, y):
| return self.tk.call(self._w, 'identify', x, y)
|
'Construct a scrollbar widget with the parent MASTER.
Valid resource names: activebackground, activerelief,
background, bd, bg, borderwidth, command, cursor,
elementborderwidth, highlightbackground,
highlightcolor, highlightthickness, jump, orient,
relief, repeatdelay, repeatinterval, takefocus,
troughcolor, width.'
| def __init__(self, master=None, cnf={}, **kw):
| Widget.__init__(self, master, 'scrollbar', cnf, kw)
|
'Display the element at INDEX with activebackground and activerelief.
INDEX can be "arrow1","slider" or "arrow2".'
| def activate(self, index):
| self.tk.call(self._w, 'activate', index)
|
'Return the fractional change of the scrollbar setting if it
would be moved by DELTAX or DELTAY pixels.'
| def delta(self, deltax, deltay):
| return getdouble(self.tk.call(self._w, 'delta', deltax, deltay))
|
'Return the fractional value which corresponds to a slider
position of X,Y.'
| def fraction(self, x, y):
| return getdouble(self.tk.call(self._w, 'fraction', x, y))
|
'Return the element under position X,Y as one of
"arrow1","slider","arrow2" or "".'
| def identify(self, x, y):
| return self.tk.call(self._w, 'identify', x, y)
|
'Return the current fractional values (upper and lower end)
of the slider position.'
| def get(self):
| return self._getdoubles(self.tk.call(self._w, 'get'))
|
'Set the fractional values of the slider position (upper and
lower ends as value between 0 and 1).'
| def set(self, *args):
| self.tk.call(((self._w, 'set') + args))
|
'Construct a text widget with the parent MASTER.
STANDARD OPTIONS
background, borderwidth, cursor,
exportselection, font, foreground,
highlightbackground, highlightcolor,
highlightthickness, insertbackground,
insertborderwidth, insertofftime,
insertontime, insertwidth, padx, pady,
relief, selectbackground,
selectborderwidth, selectforeground,
setgrid, takefocus,
xscrollcommand, yscrollcommand,
WIDGET-SPECIFIC OPTIONS
autoseparators, height, maxundo,
spacing1, spacing2, spacing3,
state, tabs, undo, width, wrap,'
| def __init__(self, master=None, cnf={}, **kw):
| Widget.__init__(self, master, 'text', cnf, kw)
|
'Return a tuple of (x,y,width,height) which gives the bounding
box of the visible part of the character at the index in ARGS.'
| def bbox(self, *args):
| return (self._getints(self.tk.call(((self._w, 'bbox') + args))) or None)
|
'Return whether between index INDEX1 and index INDEX2 the
relation OP is satisfied. OP is one of <, <=, ==, >=, >, or !=.'
| def compare(self, index1, op, index2):
| return self.tk.getboolean(self.tk.call(self._w, 'compare', index1, op, index2))
|
'Turn on the internal consistency checks of the B-Tree inside the text
widget according to BOOLEAN.'
| def debug(self, boolean=None):
| return self.tk.getboolean(self.tk.call(self._w, 'debug', boolean))
|
'Delete the characters between INDEX1 and INDEX2 (not included).'
| def delete(self, index1, index2=None):
| self.tk.call(self._w, 'delete', index1, index2)
|
'Return tuple (x,y,width,height,baseline) giving the bounding box
and baseline position of the visible part of the line containing
the character at INDEX.'
| def dlineinfo(self, index):
| return self._getints(self.tk.call(self._w, 'dlineinfo', index))
|
'Return the contents of the widget between index1 and index2.
The type of contents returned in filtered based on the keyword
parameters; if \'all\', \'image\', \'mark\', \'tag\', \'text\', or \'window\' are
given and true, then the corresponding items are returned. The result
is a list of triples of the form (key, value, index). If none of the
keywords are true then \'all\' is used by default.
If the \'command\' argument is given, it is called once for each element
of the list of triples, with the values of each triple serving as the
arguments to the function. In this case the list is not returned.'
| def dump(self, index1, index2=None, command=None, **kw):
| args = []
func_name = None
result = None
if (not command):
result = []
def append_triple(key, value, index, result=result):
result.append((key, value, index))
command = append_triple
try:
if (not isinstance(command, str)):
func_name = command = self._register(command)
args += ['-command', command]
for key in kw:
if kw[key]:
args.append(('-' + key))
args.append(index1)
if index2:
args.append(index2)
self.tk.call(self._w, 'dump', *args)
return result
finally:
if func_name:
self.deletecommand(func_name)
|
'Internal method
This method controls the undo mechanism and
the modified flag. The exact behavior of the
command depends on the option argument that
follows the edit argument. The following forms
of the command are currently supported:
edit_modified, edit_redo, edit_reset, edit_separator
and edit_undo'
| def edit(self, *args):
| return self.tk.call(self._w, 'edit', *args)
|
'Get or Set the modified flag
If arg is not specified, returns the modified
flag of the widget. The insert, delete, edit undo and
edit redo commands or the user can set or clear the
modified flag. If boolean is specified, sets the
modified flag of the widget to arg.'
| def edit_modified(self, arg=None):
| return self.edit('modified', arg)
|
'Redo the last undone edit
When the undo option is true, reapplies the last
undone edits provided no other edits were done since
then. Generates an error when the redo stack is empty.
Does nothing when the undo option is false.'
| def edit_redo(self):
| return self.edit('redo')
|
'Clears the undo and redo stacks'
| def edit_reset(self):
| return self.edit('reset')
|
'Inserts a separator (boundary) on the undo stack.
Does nothing when the undo option is false'
| def edit_separator(self):
| return self.edit('separator')
|
'Undoes the last edit action
If the undo option is true. An edit action is defined
as all the insert and delete commands that are recorded
on the undo stack in between two separators. Generates
an error when the undo stack is empty. Does nothing
when the undo option is false'
| def edit_undo(self):
| return self.edit('undo')
|
'Return the text from INDEX1 to INDEX2 (not included).'
| def get(self, index1, index2=None):
| return self.tk.call(self._w, 'get', index1, index2)
|
'Return the value of OPTION of an embedded image at INDEX.'
| def image_cget(self, index, option):
| if (option[:1] != '-'):
option = ('-' + option)
if (option[(-1):] == '_'):
option = option[:(-1)]
return self.tk.call(self._w, 'image', 'cget', index, option)
|
'Configure an embedded image at INDEX.'
| def image_configure(self, index, cnf=None, **kw):
| return self._configure(('image', 'configure', index), cnf, kw)
|
'Create an embedded image at INDEX.'
| def image_create(self, index, cnf={}, **kw):
| return self.tk.call(self._w, 'image', 'create', index, *self._options(cnf, kw))
|
'Return all names of embedded images in this widget.'
| def image_names(self):
| return self.tk.call(self._w, 'image', 'names')
|
'Return the index in the form line.char for INDEX.'
| def index(self, index):
| return str(self.tk.call(self._w, 'index', index))
|
'Insert CHARS before the characters at INDEX. An additional
tag can be given in ARGS. Additional CHARS and tags can follow in ARGS.'
| def insert(self, index, chars, *args):
| self.tk.call(((self._w, 'insert', index, chars) + args))
|
'Change the gravity of a mark MARKNAME to DIRECTION (LEFT or RIGHT).
Return the current value if None is given for DIRECTION.'
| def mark_gravity(self, markName, direction=None):
| return self.tk.call((self._w, 'mark', 'gravity', markName, direction))
|
'Return all mark names.'
| def mark_names(self):
| return self.tk.splitlist(self.tk.call(self._w, 'mark', 'names'))
|
'Set mark MARKNAME before the character at INDEX.'
| def mark_set(self, markName, index):
| self.tk.call(self._w, 'mark', 'set', markName, index)
|
'Delete all marks in MARKNAMES.'
| def mark_unset(self, *markNames):
| self.tk.call(((self._w, 'mark', 'unset') + markNames))
|
'Return the name of the next mark after INDEX.'
| def mark_next(self, index):
| return (self.tk.call(self._w, 'mark', 'next', index) or None)
|
'Return the name of the previous mark before INDEX.'
| def mark_previous(self, index):
| return (self.tk.call(self._w, 'mark', 'previous', index) or None)
|
'Remember the current X, Y coordinates.'
| def scan_mark(self, x, y):
| self.tk.call(self._w, 'scan', 'mark', x, y)
|
'Adjust the view of the text to 10 times the
difference between X and Y and the coordinates given in
scan_mark.'
| def scan_dragto(self, x, y):
| self.tk.call(self._w, 'scan', 'dragto', x, y)
|
'Search PATTERN beginning from INDEX until STOPINDEX.
Return the index of the first character of a match or an
empty string.'
| def search(self, pattern, index, stopindex=None, forwards=None, backwards=None, exact=None, regexp=None, nocase=None, count=None, elide=None):
| args = [self._w, 'search']
if forwards:
args.append('-forwards')
if backwards:
args.append('-backwards')
if exact:
args.append('-exact')
if regexp:
args.append('-regexp')
if nocase:
args.append('-nocase')
if elide:
args.append('-elide')
if count:
args.append('-count')
args.append(count)
if (pattern and (pattern[0] == '-')):
args.append('--')
args.append(pattern)
args.append(index)
if stopindex:
args.append(stopindex)
return str(self.tk.call(tuple(args)))
|
'Scroll such that the character at INDEX is visible.'
| def see(self, index):
| self.tk.call(self._w, 'see', index)
|
'Add tag TAGNAME to all characters between INDEX1 and index2 in ARGS.
Additional pairs of indices may follow in ARGS.'
| def tag_add(self, tagName, index1, *args):
| self.tk.call(((self._w, 'tag', 'add', tagName, index1) + args))
|
'Unbind for all characters with TAGNAME for event SEQUENCE the
function identified with FUNCID.'
| def tag_unbind(self, tagName, sequence, funcid=None):
| self.tk.call(self._w, 'tag', 'bind', tagName, sequence, '')
if funcid:
self.deletecommand(funcid)
|
'Bind to all characters with TAGNAME at event SEQUENCE a call to function FUNC.
An additional boolean parameter ADD specifies whether FUNC will be
called additionally to the other bound function or whether it will
replace the previous function. See bind for the return value.'
| def tag_bind(self, tagName, sequence, func, add=None):
| return self._bind((self._w, 'tag', 'bind', tagName), sequence, func, add)
|
'Return the value of OPTION for tag TAGNAME.'
| def tag_cget(self, tagName, option):
| if (option[:1] != '-'):
option = ('-' + option)
if (option[(-1):] == '_'):
option = option[:(-1)]
return self.tk.call(self._w, 'tag', 'cget', tagName, option)
|
'Configure a tag TAGNAME.'
| def tag_configure(self, tagName, cnf=None, **kw):
| return self._configure(('tag', 'configure', tagName), cnf, kw)
|
'Delete all tags in TAGNAMES.'
| def tag_delete(self, *tagNames):
| self.tk.call(((self._w, 'tag', 'delete') + tagNames))
|
'Change the priority of tag TAGNAME such that it is lower
than the priority of BELOWTHIS.'
| def tag_lower(self, tagName, belowThis=None):
| self.tk.call(self._w, 'tag', 'lower', tagName, belowThis)
|
'Return a list of all tag names.'
| def tag_names(self, index=None):
| return self.tk.splitlist(self.tk.call(self._w, 'tag', 'names', index))
|
'Return a list of start and end index for the first sequence of
characters between INDEX1 and INDEX2 which all have tag TAGNAME.
The text is searched forward from INDEX1.'
| def tag_nextrange(self, tagName, index1, index2=None):
| return self.tk.splitlist(self.tk.call(self._w, 'tag', 'nextrange', tagName, index1, index2))
|
'Return a list of start and end index for the first sequence of
characters between INDEX1 and INDEX2 which all have tag TAGNAME.
The text is searched backwards from INDEX1.'
| def tag_prevrange(self, tagName, index1, index2=None):
| return self.tk.splitlist(self.tk.call(self._w, 'tag', 'prevrange', tagName, index1, index2))
|
'Change the priority of tag TAGNAME such that it is higher
than the priority of ABOVETHIS.'
| def tag_raise(self, tagName, aboveThis=None):
| self.tk.call(self._w, 'tag', 'raise', tagName, aboveThis)
|
'Return a list of ranges of text which have tag TAGNAME.'
| def tag_ranges(self, tagName):
| return self.tk.splitlist(self.tk.call(self._w, 'tag', 'ranges', tagName))
|
'Remove tag TAGNAME from all characters between INDEX1 and INDEX2.'
| def tag_remove(self, tagName, index1, index2=None):
| self.tk.call(self._w, 'tag', 'remove', tagName, index1, index2)
|
'Return the value of OPTION of an embedded window at INDEX.'
| def window_cget(self, index, option):
| if (option[:1] != '-'):
option = ('-' + option)
if (option[(-1):] == '_'):
option = option[:(-1)]
return self.tk.call(self._w, 'window', 'cget', index, option)
|
'Configure an embedded window at INDEX.'
| def window_configure(self, index, cnf=None, **kw):
| return self._configure(('window', 'configure', index), cnf, kw)
|
'Create a window at INDEX.'
| def window_create(self, index, cnf={}, **kw):
| self.tk.call(((self._w, 'window', 'create', index) + self._options(cnf, kw)))
|
'Return all names of embedded windows in this widget.'
| def window_names(self):
| return self.tk.splitlist(self.tk.call(self._w, 'window', 'names'))
|
'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 = kwargs.get('command')
if ('command' in kwargs):
del kwargs['command']
if kwargs:
raise TclError, ('unknown option -' + kwargs.keys()[0])
menu.add_command(label=value, command=_setit(variable, value, callback))
for v in values:
menu.add_command(label=v, command=_setit(variable, v, callback))
self['menu'] = menu
|
'Destroy this widget and the associated menu.'
| def destroy(self):
| Menubutton.destroy(self)
self.__menu = None
|
'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 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, repeatinterval,
selectbackground, selectborderwidth
selectforeground, takefocus, textvariable
xscrollcommand.
WIDGET-SPECIFIC OPTIONS
buttonbackground, buttoncursor,
buttondownrelief, buttonuprelief,
command, disabledbackground,
disabledforeground, format, from,
invalidcommand, increment,
readonlybackground, state, to,
validate, validatecommand values,
width, wrap,'
| 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 height of the character, in pixels. The
bounding box may refer to a region outside the
visible area of the window.'
| 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 speed
through the window. The return value is an empty string.'
| 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 selection is created to include
the characters between index and the most recent selection
anchor point, inclusive. Returns an empty string.'
| 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)
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.