desc
stringlengths 3
26.7k
| decl
stringlengths 11
7.89k
| bodies
stringlengths 8
553k
|
---|---|---|
'Internal function.'
| def _configure(self, cmd, cnf, 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(_flatten((self._w, cmd)))):
cnf[x[0][1:]] = ((x[0][1:],) + x[1:])
return cnf
if (type(cnf) is StringType):
x = self.tk.split(self.tk.call(_flatten((self._w, cmd, ('-' + cnf)))))
return ((x[0][1:],) + x[1:])
self.tk.call((_flatten((self._w, cmd)) + self._options(cnf)))
|
'Configure resources of a widget.
The values for resources are specified as keyword
arguments. To get an overview about
the allowed keyword arguments call the method keys.'
| def configure(self, cnf=None, **kw):
| return self._configure('configure', cnf, kw)
|
'Return the resource value for a KEY given as string.'
| def cget(self, key):
| return self.tk.call(self._w, 'cget', ('-' + key))
|
'Return a list of all resource names of this widget.'
| def keys(self):
| return map((lambda x: x[0][1:]), self.tk.split(self.tk.call(self._w, 'configure')))
|
'Return the window path name of this widget.'
| def __str__(self):
| return self._w
|
'Set or get the status for propagation of geometry information.
A boolean argument specifies whether the geometry information
of the slaves will determine the size of this widget. If no argument
is given the current setting will be returned.'
| def pack_propagate(self, flag=_noarg_):
| if (flag is Misc._noarg_):
return self._getboolean(self.tk.call('pack', 'propagate', self._w))
else:
self.tk.call('pack', 'propagate', self._w, flag)
|
'Return a list of all slaves of this widget
in its packing order.'
| def pack_slaves(self):
| return map(self._nametowidget, self.tk.splitlist(self.tk.call('pack', 'slaves', self._w)))
|
'Return a list of all slaves of this widget
in its packing order.'
| def place_slaves(self):
| return map(self._nametowidget, self.tk.splitlist(self.tk.call('place', 'slaves', self._w)))
|
'Return a tuple of integer coordinates for the bounding
box of this widget controlled by the geometry manager grid.
If COLUMN, ROW is given the bounding box applies from
the cell with row and column 0 to the specified
cell. If COL2 and ROW2 are given the bounding box
starts at that cell.
The returned integers specify the offset of the upper left
corner in the master widget and the width and height.'
| def grid_bbox(self, column=None, row=None, col2=None, row2=None):
| args = ('grid', 'bbox', self._w)
if ((column is not None) and (row is not None)):
args = (args + (column, row))
if ((col2 is not None) and (row2 is not None)):
args = (args + (col2, row2))
return (self._getints(self.tk.call(*args)) or None)
|
'Internal function.'
| def _grid_configure(self, command, index, cnf, kw):
| if ((type(cnf) is StringType) and (not kw)):
if (cnf[(-1):] == '_'):
cnf = cnf[:(-1)]
if (cnf[:1] != '-'):
cnf = ('-' + cnf)
options = (cnf,)
else:
options = self._options(cnf, kw)
if (not options):
res = self.tk.call('grid', command, self._w, index)
words = self.tk.splitlist(res)
dict = {}
for i in range(0, len(words), 2):
key = words[i][1:]
value = words[(i + 1)]
if (not value):
value = None
elif ('.' in value):
value = getdouble(value)
else:
value = getint(value)
dict[key] = value
return dict
res = self.tk.call((('grid', command, self._w, index) + options))
if (len(options) == 1):
if (not res):
return None
if ('.' in res):
return getdouble(res)
return getint(res)
|
'Configure column INDEX of a grid.
Valid resources are minsize (minimum size of the column),
weight (how much does additional space propagate to this column)
and pad (how much space to let additionally).'
| def grid_columnconfigure(self, index, cnf={}, **kw):
| return self._grid_configure('columnconfigure', index, cnf, kw)
|
'Return a tuple of column and row which identify the cell
at which the pixel at position X and Y inside the master
widget is located.'
| def grid_location(self, x, y):
| return (self._getints(self.tk.call('grid', 'location', self._w, x, y)) or None)
|
'Set or get the status for propagation of geometry information.
A boolean argument specifies whether the geometry information
of the slaves will determine the size of this widget. If no argument
is given, the current setting will be returned.'
| def grid_propagate(self, flag=_noarg_):
| if (flag is Misc._noarg_):
return self._getboolean(self.tk.call('grid', 'propagate', self._w))
else:
self.tk.call('grid', 'propagate', self._w, flag)
|
'Configure row INDEX of a grid.
Valid resources are minsize (minimum size of the row),
weight (how much does additional space propagate to this row)
and pad (how much space to let additionally).'
| def grid_rowconfigure(self, index, cnf={}, **kw):
| return self._grid_configure('rowconfigure', index, cnf, kw)
|
'Return a tuple of the number of column and rows in the grid.'
| def grid_size(self):
| return (self._getints(self.tk.call('grid', 'size', self._w)) or None)
|
'Return a list of all slaves of this widget
in its packing order.'
| def grid_slaves(self, row=None, column=None):
| args = ()
if (row is not None):
args = (args + ('-row', row))
if (column is not None):
args = (args + ('-column', column))
return map(self._nametowidget, self.tk.splitlist(self.tk.call((('grid', 'slaves', self._w) + args))))
|
'Bind a virtual event VIRTUAL (of the form <<Name>>)
to an event SEQUENCE such that the virtual event is triggered
whenever SEQUENCE occurs.'
| def event_add(self, virtual, *sequences):
| args = (('event', 'add', virtual) + sequences)
self.tk.call(args)
|
'Unbind a virtual event VIRTUAL from SEQUENCE.'
| def event_delete(self, virtual, *sequences):
| args = (('event', 'delete', virtual) + sequences)
self.tk.call(args)
|
'Generate an event SEQUENCE. Additional
keyword arguments specify parameter of the event
(e.g. x, y, rootx, rooty).'
| def event_generate(self, sequence, **kw):
| args = ('event', 'generate', self._w, sequence)
for (k, v) in kw.items():
args = (args + (('-%s' % k), str(v)))
self.tk.call(args)
|
'Return a list of all virtual events or the information
about the SEQUENCE bound to the virtual event VIRTUAL.'
| def event_info(self, virtual=None):
| return self.tk.splitlist(self.tk.call('event', 'info', virtual))
|
'Return a list of all existing image names.'
| def image_names(self):
| return self.tk.call('image', 'names')
|
'Return a list of all available image types (e.g. phote bitmap).'
| def image_types(self):
| return self.tk.call('image', 'types')
|
'Store FUNC, SUBST and WIDGET as members.'
| def __init__(self, func, subst, widget):
| self.func = func
self.subst = subst
self.widget = widget
|
'Apply first function SUBST to arguments, than FUNC.'
| def __call__(self, *args):
| try:
if self.subst:
args = self.subst(*args)
return self.func(*args)
except SystemExit as msg:
raise SystemExit, msg
except:
self.widget._report_exception()
|
'Query and change the horizontal position of the view.'
| def xview(self, *args):
| res = self.tk.call(self._w, 'xview', *args)
if (not args):
return self._getdoubles(res)
|
'Adjusts the view in the window so that FRACTION of the
total width of the canvas is off-screen to the left.'
| def xview_moveto(self, fraction):
| self.tk.call(self._w, 'xview', 'moveto', fraction)
|
'Shift the x-view according to NUMBER which is measured in "units"
or "pages" (WHAT).'
| def xview_scroll(self, number, what):
| self.tk.call(self._w, 'xview', 'scroll', number, what)
|
'Query and change the vertical position of the view.'
| def yview(self, *args):
| res = self.tk.call(self._w, 'yview', *args)
if (not args):
return self._getdoubles(res)
|
'Adjusts the view in the window so that FRACTION of the
total height of the canvas is off-screen to the top.'
| def yview_moveto(self, fraction):
| self.tk.call(self._w, 'yview', 'moveto', fraction)
|
'Shift the y-view according to NUMBER which is measured in
"units" or "pages" (WHAT).'
| def yview_scroll(self, number, what):
| self.tk.call(self._w, 'yview', 'scroll', number, what)
|
'Instruct the window manager to set the aspect ratio (width/height)
of this widget to be between MINNUMER/MINDENOM and MAXNUMER/MAXDENOM. Return a tuple
of the actual values if no argument is given.'
| def wm_aspect(self, minNumer=None, minDenom=None, maxNumer=None, maxDenom=None):
| return self._getints(self.tk.call('wm', 'aspect', self._w, minNumer, minDenom, maxNumer, maxDenom))
|
'This subcommand returns or sets platform specific attributes
The first form returns a list of the platform specific flags and
their values. The second form returns the value for the specific
option. The third form sets one or more of the values. The values
are as follows:
On Windows, -disabled gets or sets whether the window is in a
disabled state. -toolwindow gets or sets the style of the window
to toolwindow (as defined in the MSDN). -topmost gets or sets
whether this is a topmost window (displays above all other
windows).
On Macintosh, XXXXX
On Unix, there are currently no special attribute values.'
| def wm_attributes(self, *args):
| args = (('wm', 'attributes', self._w) + args)
return self.tk.call(args)
|
'Store NAME in WM_CLIENT_MACHINE property of this widget. Return
current value.'
| def wm_client(self, name=None):
| return self.tk.call('wm', 'client', self._w, name)
|
'Store list of window names (WLIST) into WM_COLORMAPWINDOWS property
of this widget. This list contains windows whose colormaps differ from their
parents. Return current list of widgets if WLIST is empty.'
| def wm_colormapwindows(self, *wlist):
| if (len(wlist) > 1):
wlist = (wlist,)
args = (('wm', 'colormapwindows', self._w) + wlist)
return map(self._nametowidget, self.tk.call(args))
|
'Store VALUE in WM_COMMAND property. It is the command
which shall be used to invoke the application. Return current
command if VALUE is None.'
| def wm_command(self, value=None):
| return self.tk.call('wm', 'command', self._w, value)
|
'Deiconify this widget. If it was never mapped it will not be mapped.
On Windows it will raise this widget and give it the focus.'
| def wm_deiconify(self):
| return self.tk.call('wm', 'deiconify', self._w)
|
'Set focus model to MODEL. "active" means that this widget will claim
the focus itself, "passive" means that the window manager shall give
the focus. Return current focus model if MODEL is None.'
| def wm_focusmodel(self, model=None):
| return self.tk.call('wm', 'focusmodel', self._w, model)
|
'Return identifier for decorative frame of this widget if present.'
| def wm_frame(self):
| return self.tk.call('wm', 'frame', self._w)
|
'Set geometry to NEWGEOMETRY of the form =widthxheight+x+y. Return
current value if None is given.'
| def wm_geometry(self, newGeometry=None):
| return self.tk.call('wm', 'geometry', self._w, newGeometry)
|
'Instruct the window manager that this widget shall only be
resized on grid boundaries. WIDTHINC and HEIGHTINC are the width and
height of a grid unit in pixels. BASEWIDTH and BASEHEIGHT are the
number of grid units requested in Tk_GeometryRequest.'
| def wm_grid(self, baseWidth=None, baseHeight=None, widthInc=None, heightInc=None):
| return self._getints(self.tk.call('wm', 'grid', self._w, baseWidth, baseHeight, widthInc, heightInc))
|
'Set the group leader widgets for related widgets to PATHNAME. Return
the group leader of this widget if None is given.'
| def wm_group(self, pathName=None):
| return self.tk.call('wm', 'group', self._w, pathName)
|
'Set bitmap for the iconified widget to BITMAP. Return
the bitmap if None is given.
Under Windows, the DEFAULT parameter can be used to set the icon
for the widget and any descendents that don\'t have an icon set
explicitly. DEFAULT can be the relative path to a .ico file
(example: root.iconbitmap(default=\'myicon.ico\') ). See Tk
documentation for more information.'
| def wm_iconbitmap(self, bitmap=None, default=None):
| if default:
return self.tk.call('wm', 'iconbitmap', self._w, '-default', default)
else:
return self.tk.call('wm', 'iconbitmap', self._w, bitmap)
|
'Display widget as icon.'
| def wm_iconify(self):
| return self.tk.call('wm', 'iconify', self._w)
|
'Set mask for the icon bitmap of this widget. Return the
mask if None is given.'
| def wm_iconmask(self, bitmap=None):
| return self.tk.call('wm', 'iconmask', self._w, bitmap)
|
'Set the name of the icon for this widget. Return the name if
None is given.'
| def wm_iconname(self, newName=None):
| return self.tk.call('wm', 'iconname', self._w, newName)
|
'Set the position of the icon of this widget to X and Y. Return
a tuple of the current values of X and X if None is given.'
| def wm_iconposition(self, x=None, y=None):
| return self._getints(self.tk.call('wm', 'iconposition', self._w, x, y))
|
'Set widget PATHNAME to be displayed instead of icon. Return the current
value if None is given.'
| def wm_iconwindow(self, pathName=None):
| return self.tk.call('wm', 'iconwindow', self._w, pathName)
|
'Set max WIDTH and HEIGHT for this widget. If the window is gridded
the values are given in grid units. Return the current values if None
is given.'
| def wm_maxsize(self, width=None, height=None):
| return self._getints(self.tk.call('wm', 'maxsize', self._w, width, height))
|
'Set min WIDTH and HEIGHT for this widget. If the window is gridded
the values are given in grid units. Return the current values if None
is given.'
| def wm_minsize(self, width=None, height=None):
| return self._getints(self.tk.call('wm', 'minsize', self._w, width, height))
|
'Instruct the window manager to ignore this widget
if BOOLEAN is given with 1. Return the current value if None
is given.'
| def wm_overrideredirect(self, boolean=None):
| return self._getboolean(self.tk.call('wm', 'overrideredirect', self._w, boolean))
|
'Instruct the window manager that the position of this widget shall
be defined by the user if WHO is "user", and by its own policy if WHO is
"program".'
| def wm_positionfrom(self, who=None):
| return self.tk.call('wm', 'positionfrom', self._w, who)
|
'Bind function FUNC to command NAME for this widget.
Return the function bound to NAME if None is given. NAME could be
e.g. "WM_SAVE_YOURSELF" or "WM_DELETE_WINDOW".'
| def wm_protocol(self, name=None, func=None):
| if hasattr(func, '__call__'):
command = self._register(func)
else:
command = func
return self.tk.call('wm', 'protocol', self._w, name, command)
|
'Instruct the window manager whether this width can be resized
in WIDTH or HEIGHT. Both values are boolean values.'
| def wm_resizable(self, width=None, height=None):
| return self.tk.call('wm', 'resizable', self._w, width, height)
|
'Instruct the window manager that the size of this widget shall
be defined by the user if WHO is "user", and by its own policy if WHO is
"program".'
| def wm_sizefrom(self, who=None):
| return self.tk.call('wm', 'sizefrom', self._w, who)
|
'Query or set the state of this widget as one of normal, icon,
iconic (see wm_iconwindow), withdrawn, or zoomed (Windows only).'
| def wm_state(self, newstate=None):
| return self.tk.call('wm', 'state', self._w, newstate)
|
'Set the title of this widget.'
| def wm_title(self, string=None):
| return self.tk.call('wm', 'title', self._w, string)
|
'Instruct the window manager that this widget is transient
with regard to widget MASTER.'
| def wm_transient(self, master=None):
| return self.tk.call('wm', 'transient', self._w, master)
|
'Withdraw this widget from the screen such that it is unmapped
and forgotten by the window manager. Re-draw it with wm_deiconify.'
| def wm_withdraw(self):
| return self.tk.call('wm', 'withdraw', self._w)
|
'Return a new Toplevel widget on screen SCREENNAME. A new Tcl interpreter will
be created. BASENAME will be used for the identification of the profile file (see
readprofile).
It is constructed from sys.argv[0] without extensions if None is given. CLASSNAME
is the name of the widget class.'
| def __init__(self, screenName=None, baseName=None, className='Tk', useTk=1, sync=0, use=None):
| self.master = None
self.children = {}
self._tkloaded = 0
self.tk = None
if (baseName is None):
import sys, os
baseName = os.path.basename(sys.argv[0])
(baseName, ext) = os.path.splitext(baseName)
if (ext not in ('.py', '.pyc', '.pyo')):
baseName = (baseName + ext)
interactive = 0
self.tk = _tkinter.create(screenName, baseName, className, interactive, wantobjects, useTk, sync, use)
if useTk:
self._loadtk()
self.readprofile(baseName, className)
|
'Destroy this and all descendants widgets. This will
end the application of this Tcl interpreter.'
| def destroy(self):
| for c in self.children.values():
c.destroy()
self.tk.call('destroy', self._w)
Misc.destroy(self)
global _default_root
if (_support_default_root and (_default_root is self)):
_default_root = None
|
'Internal function. It reads BASENAME.tcl and CLASSNAME.tcl into
the Tcl Interpreter and calls execfile on BASENAME.py and CLASSNAME.py if
such a file exists in the home directory.'
| def readprofile(self, baseName, className):
| import os
if ('HOME' in os.environ):
home = os.environ['HOME']
else:
home = os.curdir
class_tcl = os.path.join(home, ('.%s.tcl' % className))
class_py = os.path.join(home, ('.%s.py' % className))
base_tcl = os.path.join(home, ('.%s.tcl' % baseName))
base_py = os.path.join(home, ('.%s.py' % baseName))
dir = {'self': self}
exec 'from Tkinter import *' in dir
if os.path.isfile(class_tcl):
self.tk.call('source', class_tcl)
if os.path.isfile(class_py):
execfile(class_py, dir)
if os.path.isfile(base_tcl):
self.tk.call('source', base_tcl)
if os.path.isfile(base_py):
execfile(base_py, dir)
|
'Internal function. It reports exception on sys.stderr.'
| def report_callback_exception(self, exc, val, tb):
| import traceback, sys
sys.stderr.write('Exception in Tkinter callback\n')
sys.last_type = exc
sys.last_value = val
sys.last_traceback = tb
traceback.print_exception(exc, val, tb)
|
'Delegate attribute access to the interpreter object'
| def __getattr__(self, attr):
| return getattr(self.tk, attr)
|
'Pack a widget in the parent widget. Use as options:
after=widget - pack it after you have packed widget
anchor=NSEW (or subset) - position widget according to
given direction
before=widget - pack it before you will pack widget
expand=bool - expand widget if parent size grows
fill=NONE or X or Y or BOTH - fill widget if widget grows
in=master - use master to contain this widget
in_=master - see \'in\' option description
ipadx=amount - add internal padding in x direction
ipady=amount - add internal padding in y direction
padx=amount - add padding in x direction
pady=amount - add padding in y direction
side=TOP or BOTTOM or LEFT or RIGHT - where to add this widget.'
| def pack_configure(self, cnf={}, **kw):
| self.tk.call((('pack', 'configure', self._w) + self._options(cnf, kw)))
|
'Unmap this widget and do not use it for the packing order.'
| def pack_forget(self):
| self.tk.call('pack', 'forget', self._w)
|
'Return information about the packing options
for this widget.'
| def pack_info(self):
| words = self.tk.splitlist(self.tk.call('pack', 'info', self._w))
dict = {}
for i in range(0, len(words), 2):
key = words[i][1:]
value = words[(i + 1)]
if (value[:1] == '.'):
value = self._nametowidget(value)
dict[key] = value
return dict
|
'Place a widget in the parent widget. Use as options:
in=master - master relative to which the widget is placed
in_=master - see \'in\' option description
x=amount - locate anchor of this widget at position x of master
y=amount - locate anchor of this widget at position y of master
relx=amount - locate anchor of this widget between 0.0 and 1.0
relative to width of master (1.0 is right edge)
rely=amount - locate anchor of this widget between 0.0 and 1.0
relative to height of master (1.0 is bottom edge)
anchor=NSEW (or subset) - position anchor according to given direction
width=amount - width of this widget in pixel
height=amount - height of this widget in pixel
relwidth=amount - width of this widget between 0.0 and 1.0
relative to width of master (1.0 is the same width
as the master)
relheight=amount - height of this widget between 0.0 and 1.0
relative to height of master (1.0 is the same
height as the master)
bordermode="inside" or "outside" - whether to take border width of
master widget into account'
| def place_configure(self, cnf={}, **kw):
| self.tk.call((('place', 'configure', self._w) + self._options(cnf, kw)))
|
'Unmap this widget.'
| def place_forget(self):
| self.tk.call('place', 'forget', self._w)
|
'Return information about the placing options
for this widget.'
| def place_info(self):
| words = self.tk.splitlist(self.tk.call('place', 'info', self._w))
dict = {}
for i in range(0, len(words), 2):
key = words[i][1:]
value = words[(i + 1)]
if (value[:1] == '.'):
value = self._nametowidget(value)
dict[key] = value
return dict
|
'Position a widget in the parent widget in a grid. Use as options:
column=number - use cell identified with given column (starting with 0)
columnspan=number - this widget will span several columns
in=master - use master to contain this widget
in_=master - see \'in\' option description
ipadx=amount - add internal padding in x direction
ipady=amount - add internal padding in y direction
padx=amount - add padding in x direction
pady=amount - add padding in y direction
row=number - use cell identified with given row (starting with 0)
rowspan=number - this widget will span several rows
sticky=NSEW - if cell is larger on which sides will this
widget stick to the cell boundary'
| def grid_configure(self, cnf={}, **kw):
| self.tk.call((('grid', 'configure', self._w) + self._options(cnf, kw)))
|
'Unmap this widget.'
| def grid_forget(self):
| self.tk.call('grid', 'forget', self._w)
|
'Unmap this widget but remember the grid options.'
| def grid_remove(self):
| self.tk.call('grid', 'remove', self._w)
|
'Return information about the options
for positioning this widget in a grid.'
| def grid_info(self):
| words = self.tk.splitlist(self.tk.call('grid', 'info', self._w))
dict = {}
for i in range(0, len(words), 2):
key = words[i][1:]
value = words[(i + 1)]
if (value[:1] == '.'):
value = self._nametowidget(value)
dict[key] = value
return dict
|
'Internal function. Sets up information about children.'
| def _setup(self, master, cnf):
| if _support_default_root:
global _default_root
if (not master):
if (not _default_root):
_default_root = Tk()
master = _default_root
self.master = master
self.tk = master.tk
name = None
if ('name' in cnf):
name = cnf['name']
del cnf['name']
if (not name):
name = repr(id(self))
self._name = name
if (master._w == '.'):
self._w = ('.' + name)
else:
self._w = ((master._w + '.') + name)
self.children = {}
if (self._name in self.master.children):
self.master.children[self._name].destroy()
self.master.children[self._name] = self
|
'Construct a widget with the parent widget MASTER, a name WIDGETNAME
and appropriate options.'
| def __init__(self, master, widgetName, cnf={}, kw={}, extra=()):
| if kw:
cnf = _cnfmerge((cnf, kw))
self.widgetName = widgetName
BaseWidget._setup(self, master, cnf)
if (self._tclCommands is None):
self._tclCommands = []
classes = []
for k in cnf.keys():
if (type(k) is ClassType):
classes.append((k, cnf[k]))
del cnf[k]
self.tk.call((((widgetName, self._w) + extra) + self._options(cnf)))
for (k, v) in classes:
k.configure(self, v)
|
'Destroy this and all descendants widgets.'
| def destroy(self):
| for c in self.children.values():
c.destroy()
self.tk.call('destroy', self._w)
if (self._name in self.master.children):
del self.master.children[self._name]
Misc.destroy(self)
|
'Construct a toplevel widget with the parent MASTER.
Valid resource names: background, bd, bg, borderwidth, class,
colormap, container, cursor, height, highlightbackground,
highlightcolor, highlightthickness, menu, relief, screen, takefocus,
use, visual, width.'
| def __init__(self, master=None, cnf={}, **kw):
| if kw:
cnf = _cnfmerge((cnf, kw))
extra = ()
for wmkey in ['screen', 'class_', 'class', 'visual', 'colormap']:
if (wmkey in cnf):
val = cnf[wmkey]
if (wmkey[(-1)] == '_'):
opt = ('-' + wmkey[:(-1)])
else:
opt = ('-' + wmkey)
extra = (extra + (opt, val))
del cnf[wmkey]
BaseWidget.__init__(self, master, 'toplevel', cnf, {}, extra)
root = self._root()
self.iconname(root.iconname())
self.title(root.title())
self.protocol('WM_DELETE_WINDOW', self.destroy)
|
'Construct a button widget with the parent MASTER.
STANDARD OPTIONS
activebackground, activeforeground, anchor,
background, bitmap, borderwidth, cursor,
disabledforeground, font, foreground
highlightbackground, highlightcolor,
highlightthickness, image, justify,
padx, pady, relief, repeatdelay,
repeatinterval, takefocus, text,
textvariable, underline, wraplength
WIDGET-SPECIFIC OPTIONS
command, compound, default, height,
overrelief, state, width'
| def __init__(self, master=None, cnf={}, **kw):
| Widget.__init__(self, master, 'button', cnf, kw)
|
'Flash the button.
This is accomplished by redisplaying
the button several times, alternating between active and
normal colors. At the end of the flash the button is left
in the same normal/active state as when the command was
invoked. This command is ignored if the button\'s state is
disabled.'
| def flash(self):
| self.tk.call(self._w, 'flash')
|
'Invoke the command associated with the button.
The return value is the return value from the command,
or an empty string if there is no command associated with
the button. This command is ignored if the button\'s state
is disabled.'
| def invoke(self):
| return self.tk.call(self._w, 'invoke')
|
'Construct a canvas widget with the parent MASTER.
Valid resource names: background, bd, bg, borderwidth, closeenough,
confine, cursor, height, highlightbackground, highlightcolor,
highlightthickness, insertbackground, insertborderwidth,
insertofftime, insertontime, insertwidth, offset, relief,
scrollregion, selectbackground, selectborderwidth, selectforeground,
state, takefocus, width, xscrollcommand, xscrollincrement,
yscrollcommand, yscrollincrement.'
| def __init__(self, master=None, cnf={}, **kw):
| Widget.__init__(self, master, 'canvas', cnf, kw)
|
'Internal function.'
| def addtag(self, *args):
| self.tk.call(((self._w, 'addtag') + args))
|
'Add tag NEWTAG to all items above TAGORID.'
| def addtag_above(self, newtag, tagOrId):
| self.addtag(newtag, 'above', tagOrId)
|
'Add tag NEWTAG to all items.'
| def addtag_all(self, newtag):
| self.addtag(newtag, 'all')
|
'Add tag NEWTAG to all items below TAGORID.'
| def addtag_below(self, newtag, tagOrId):
| self.addtag(newtag, 'below', tagOrId)
|
'Add tag NEWTAG to item which is closest to pixel at X, Y.
If several match take the top-most.
All items closer than HALO are considered overlapping (all are
closests). If START is specified the next below this tag is taken.'
| def addtag_closest(self, newtag, x, y, halo=None, start=None):
| self.addtag(newtag, 'closest', x, y, halo, start)
|
'Add tag NEWTAG to all items in the rectangle defined
by X1,Y1,X2,Y2.'
| def addtag_enclosed(self, newtag, x1, y1, x2, y2):
| self.addtag(newtag, 'enclosed', x1, y1, x2, y2)
|
'Add tag NEWTAG to all items which overlap the rectangle
defined by X1,Y1,X2,Y2.'
| def addtag_overlapping(self, newtag, x1, y1, x2, y2):
| self.addtag(newtag, 'overlapping', x1, y1, x2, y2)
|
'Add tag NEWTAG to all items with TAGORID.'
| def addtag_withtag(self, newtag, tagOrId):
| self.addtag(newtag, 'withtag', tagOrId)
|
'Return a tuple of X1,Y1,X2,Y2 coordinates for a rectangle
which encloses all items with tags specified as arguments.'
| def bbox(self, *args):
| return (self._getints(self.tk.call(((self._w, 'bbox') + args))) or None)
|
'Unbind for all items with TAGORID for event SEQUENCE the
function identified with FUNCID.'
| def tag_unbind(self, tagOrId, sequence, funcid=None):
| self.tk.call(self._w, 'bind', tagOrId, sequence, '')
if funcid:
self.deletecommand(funcid)
|
'Bind to all items with TAGORID 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, tagOrId, sequence=None, func=None, add=None):
| return self._bind((self._w, 'bind', tagOrId), sequence, func, add)
|
'Return the canvas x coordinate of pixel position SCREENX rounded
to nearest multiple of GRIDSPACING units.'
| def canvasx(self, screenx, gridspacing=None):
| return getdouble(self.tk.call(self._w, 'canvasx', screenx, gridspacing))
|
'Return the canvas y coordinate of pixel position SCREENY rounded
to nearest multiple of GRIDSPACING units.'
| def canvasy(self, screeny, gridspacing=None):
| return getdouble(self.tk.call(self._w, 'canvasy', screeny, gridspacing))
|
'Return a list of coordinates for the item given in ARGS.'
| def coords(self, *args):
| return map(getdouble, self.tk.splitlist(self.tk.call(((self._w, 'coords') + args))))
|
'Internal function.'
| def _create(self, itemType, args, kw):
| args = _flatten(args)
cnf = args[(-1)]
if (type(cnf) in (DictionaryType, TupleType)):
args = args[:(-1)]
else:
cnf = {}
return getint(self.tk.call(self._w, 'create', itemType, *(args + self._options(cnf, kw))))
|
'Create arc shaped region with coordinates x1,y1,x2,y2.'
| def create_arc(self, *args, **kw):
| return self._create('arc', args, kw)
|
'Create bitmap with coordinates x1,y1.'
| def create_bitmap(self, *args, **kw):
| return self._create('bitmap', args, kw)
|
'Create image item with coordinates x1,y1.'
| def create_image(self, *args, **kw):
| return self._create('image', args, kw)
|
'Create line with coordinates x1,y1,...,xn,yn.'
| def create_line(self, *args, **kw):
| return self._create('line', args, kw)
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.