The Text Class

A display/editor widget for formatted text.

Options

Use as keyword arguments when constructing the widget, or with the configuration methods.

Option Resource Class Default
backgroundbackgroundBackgroundSystemWindow
bd (see borderwidth )
bg (see background )
borderwidthborderWidthBorderWidth2
cursorcursorCursorxterm
exportselectionexportSelectionExportSelection1
fg (see foreground )
fontfontFontMS Sans Serif 8
foregroundforegroundForegroundSystemWindowText
heightheightHeight24
highlightbackgroundhighlightBackgroundHighlightBackgroundSystemButtonFace
highlightcolorhighlightColorHighlightColorSystemWindowFrame
highlightthicknesshighlightThicknessHighlightThickness0
insertbackgroundinsertBackgroundForegroundSystemWindowText
insertborderwidthinsertBorderWidthBorderWidth0
insertofftimeinsertOffTimeOffTime300
insertontimeinsertOnTimeOnTime600
insertwidthinsertWidthInsertWidth2
padxpadXPad1
padypadYPad1
reliefreliefReliefsunken
selectbackgroundselectBackgroundForegroundSystemHighlight
selectborderwidthselectBorderWidthBorderWidth0
selectforegroundselectForegroundBackgroundSystemHighlightText
setgridsetGridSetGrid0
spacing1spacing1Spacing0
spacing2spacing2Spacing0
spacing3spacing3Spacing0
statestateStatenormal
tabstabsTabs
takefocustakeFocusTakeFocus
widthwidthWidth80
wrapwrapWrapchar
xscrollcommandxScrollCommandScrollCommand
yscrollcommandyScrollCommandScrollCommand

Basic Methods

Methods defined by Text or inherited from Widget.

bbox(self, *args)
cget(self, key) (from Widget)
compare(self, index1, op, index2)
config(self, cnf=None, **kw) (from Widget)
configure(self, cnf=None, **kw) (from Widget)
debug(self, boolean=None)
delete(self, index1, index2=None)
destroy(self) (from Widget)
dlineinfo(self, index)
get(self, index1, index2=None)
index(self, index)
insert(self, index, chars, *args)
keys(self) (from Widget)
mark_gravity(self, markName, direction=None)
mark_names(self)
mark_set(self, markName, index)
mark_unset(self, *markNames)
scan_dragto(self, x, y)
scan_mark(self, x, y)
search(self, pattern, index, stopindex=None, forwards=None, backwards=None, exact=None, regexp=None, nocase=None, count=None)
see(self, index)
tag_add(self, tagName, index1, index2=None)
tag_bind(self, tagName, sequence, func, add=None)
tag_cget(self, tagName, option)
tag_config(self, tagName, cnf={}, **kw)
tag_configure(self, tagName, cnf={}, **kw)
tag_delete(self, *tagNames)
tag_lower(self, tagName, belowThis=None)
tag_names(self, index=None)
tag_nextrange(self, tagName, index1, index2=None)
tag_raise(self, tagName, aboveThis=None)
tag_ranges(self, tagName)
tag_remove(self, tagName, index1, index2=None)
tag_unbind(self, tagName, sequence)
tk_textBackspace(self)
tk_textIndexCloser(self, a, b, c)
tk_textResetAnchor(self, index)
tk_textSelectTo(self, index)
window_cget(self, index, option)
window_config(self, index, cnf={}, **kw)
window_configure(self, index, cnf={}, **kw)
window_create(self, index, cnf={}, **kw)
window_names(self)
xview(self, *what)
yview(self, *what)
yview_pickplace(self, *what)

Geometry Manager Methods

Methods inherited from Pack, Place, and Grid.

columnconfigure(self, index, cnf={}, **kw) (from Grid)
forget(self) (from Pack)
grid(self, cnf={}, **kw) (from Grid)
grid_bbox(self, column, row) (from Grid)
grid_forget(self) (from Grid)
grid_info(self) (from Grid)
grid_propagate(self, flag=['_noarg_']) (from Grid)
grid_slaves(self, *args) (from Grid)
info(self) (from Pack)
location(self, x, y) (from Grid)
pack(self, cnf={}, **kw) (from Pack)
pack_forget(self) (from Pack)
pack_info(self) (from Pack)
pack_propagate(self, flag=['_noarg_']) (from Pack)
pack_slaves(self) (from Pack)
place(self, cnf={}, **kw) (from Place)
place_forget(self) (from Place)
place_info(self) (from Place)
place_slaves(self) (from Place)
propagate(self, flag=['_noarg_']) (from Pack)
rowconfigure(self, index, cnf={}, **kw) (from Grid)
size(self) (from Grid)
slaves(self) (from Pack)

Other Methods

Methods inherited from other superclasses.

after(self, ms, func=None, *args) (from Misc)
after_cancel(self, id) (from Misc)
after_idle(self, func, *args) (from Misc)
bell(self, displayof=0) (from Misc)
bind(self, sequence=None, func=None, add=None) (from Misc)
bind_all(self, sequence=None, func=None, add=None) (from Misc)
bind_class(self, className, sequence=None, func=None, add=None) (from Misc)
bindtags(self, tagList=None) (from Misc)
clipboard_append(self, string, **kw) (from Misc)
clipboard_clear(self, **kw) (from Misc)
colormodel(self, value=None) (from Misc)
focus(self) (from Misc)
focus_displayof(self) (from Misc)
focus_force(self) (from Misc)
focus_get(self) (from Misc)
focus_lastfor(self) (from Misc)
focus_set(self) (from Misc)
getboolean(self, s) (from Misc)
getdouble(self, s) (from Misc)
getint(self, s) (from Misc)
getvar(self, name='PY_VAR') (from Misc)
grab_current(self) (from Misc)
grab_release(self) (from Misc)
grab_set(self) (from Misc)
grab_set_global(self) (from Misc)
grab_status(self) (from Misc)
lift(self, aboveThis=None) (from Misc)
lower(self, belowThis=None) (from Misc)
mainloop(self, n=0) (from Misc)
option_add(self, pattern, value, priority=None) (from Misc)
option_clear(self) (from Misc)
option_get(self, name, className) (from Misc)
option_readfile(self, fileName, priority=None) (from Misc)
quit(self) (from Misc)
register(self, func, subst=None) (from Misc)
selection_clear(self, **kw) (from Misc)
selection_get(self, **kw) (from Misc)
selection_handle(self, command, **kw) (from Misc)
selection_own(self, **kw) (from Misc)
selection_own_get(self, **kw) (from Misc)
send(self, interp, cmd, *args) (from Misc)
setvar(self, name='PY_VAR', value='1') (from Misc)
tk_bisque(self) (from Misc)
tk_focusFollowsMouse(self) (from Misc)
tk_focusNext(self) (from Misc)
tk_focusPrev(self) (from Misc)
tk_menuBar(self, *args) (from Misc)
tk_setPalette(self, *args, **kw) (from Misc)
tk_strictMotif(self, boolean=None) (from Misc)
tkraise(self, aboveThis=None) (from Misc)
unbind(self, sequence) (from Misc)
unbind_all(self, sequence) (from Misc)
unbind_class(self, className, sequence) (from Misc)
update(self) (from Misc)
update_idletasks(self) (from Misc)
wait_variable(self, name='PY_VAR') (from Misc)
wait_visibility(self, window=None) (from Misc)
wait_window(self, window=None) (from Misc)
waitvar(self, name='PY_VAR') (from Misc)
winfo_atom(self, name, displayof=0) (from Misc)
winfo_atomname(self, id, displayof=0) (from Misc)
winfo_cells(self) (from Misc)
winfo_children(self) (from Misc)
winfo_class(self) (from Misc)
winfo_colormapfull(self) (from Misc)
winfo_containing(self, rootX, rootY, displayof=0) (from Misc)
winfo_depth(self) (from Misc)
winfo_exists(self) (from Misc)
winfo_fpixels(self, number) (from Misc)
winfo_geometry(self) (from Misc)
winfo_height(self) (from Misc)
winfo_id(self) (from Misc)
winfo_interps(self, displayof=0) (from Misc)
winfo_ismapped(self) (from Misc)
winfo_name(self) (from Misc)
winfo_parent(self) (from Misc)
winfo_pathname(self, id, displayof=0) (from Misc)
winfo_pixels(self, number) (from Misc)
winfo_reqheight(self) (from Misc)
winfo_reqwidth(self) (from Misc)
winfo_rgb(self, color) (from Misc)
winfo_rootx(self) (from Misc)
winfo_rooty(self) (from Misc)
winfo_screen(self) (from Misc)
winfo_screencells(self) (from Misc)
winfo_screendepth(self) (from Misc)
winfo_screenheight(self) (from Misc)
winfo_screenmmheight(self) (from Misc)
winfo_screenmmwidth(self) (from Misc)
winfo_screenvisual(self) (from Misc)
winfo_screenwidth(self) (from Misc)
winfo_toplevel(self) (from Misc)
winfo_visual(self) (from Misc)
winfo_vrootheight(self) (from Misc)
winfo_vrootwidth(self) (from Misc)
winfo_vrootx(self) (from Misc)
winfo_vrooty(self) (from Misc)
winfo_width(self) (from Misc)
winfo_x(self) (from Misc)
winfo_y(self) (from Misc)

Applies to Tkinter 1.63, Tcl 8.0, and Tk 8.0