MCPcopy Index your code
hub / github.com/python/cpython / Text

Class Text

Lib/tkinter/__init__.py:3831–4284  ·  view source on GitHub ↗

Text widget which can display text in various forms.

Source from the content-addressed store, hash-verified

3829
3830
3831class Text(Widget, XView, YView):
3832 """Text widget which can display text in various forms."""
3833
3834 def __init__(self, master=None, cnf={}, **kw):
3835 """Construct a text widget with the parent MASTER.
3836
3837 STANDARD OPTIONS
3838
3839 background, borderwidth, cursor,
3840 exportselection, font, foreground,
3841 highlightbackground, highlightcolor,
3842 highlightthickness, insertbackground,
3843 insertborderwidth, insertofftime,
3844 insertontime, insertwidth, padx, pady,
3845 relief, selectbackground,
3846 selectborderwidth, selectforeground,
3847 setgrid, takefocus,
3848 xscrollcommand, yscrollcommand,
3849
3850 WIDGET-SPECIFIC OPTIONS
3851
3852 autoseparators, height, maxundo,
3853 spacing1, spacing2, spacing3,
3854 state, tabs, undo, width, wrap,
3855
3856 """
3857 Widget.__init__(self, master, 'text', cnf, kw)
3858
3859 def bbox(self, index):
3860 """Return a tuple of (x,y,width,height) which gives the bounding
3861 box of the visible part of the character at the given index."""
3862 return self._getints(
3863 self.tk.call(self._w, 'bbox', index)) or None
3864
3865 def compare(self, index1, op, index2):
3866 """Return whether between index INDEX1 and index INDEX2 the
3867 relation OP is satisfied. OP is one of <, <=, ==, >=, >, or !=."""
3868 return self.tk.getboolean(self.tk.call(
3869 self._w, 'compare', index1, op, index2))
3870
3871 def count(self, index1, index2, *options, return_ints=False): # new in Tk 8.5
3872 """Counts the number of relevant things between the two indices.
3873
3874 If INDEX1 is after INDEX2, the result will be a negative number
3875 (and this holds for each of the possible options).
3876
3877 The actual items which are counted depends on the options given.
3878 The result is a tuple of integers, one for the result of each
3879 counting option given, if more than one option is specified or
3880 return_ints is false (default), otherwise it is an integer.
3881 Valid counting options are "chars", "displaychars",
3882 "displayindices", "displaylines", "indices", "lines", "xpixels"
3883 and "ypixels". The default value, if no option is specified, is
3884 "indices". There is an additional possible option "update",
3885 which if given then all subsequent options ensure that any
3886 possible out of date information is recalculated.
3887 """
3888 options = ['-%s' % arg for arg in options]

Callers 15

_multistatus_barFunction · 0.90
_calltip_windowFunction · 0.90
_color_delegatorFunction · 0.90
_grep_dialogFunction · 0.90
_widget_redirectorFunction · 0.90
_io_bindingFunction · 0.90
_replace_dialogFunction · 0.90
__init__Method · 0.90
_search_dialogFunction · 0.90
_undo_delegatorFunction · 0.90
setUpClassMethod · 0.90

Calls

no outgoing calls

Tested by 15

setUpClassMethod · 0.72
setUpClassMethod · 0.72
setUpClassMethod · 0.72
setUpClassMethod · 0.72
setUpClassMethod · 0.72
setUpClassMethod · 0.72
setUpClassMethod · 0.72
setUpClassMethod · 0.72
setUpClassMethod · 0.72
make_text_widgetMethod · 0.72
make_mock_squeezerMethod · 0.72
setUpClassMethod · 0.72

Used in the wild real call sites across dependent graphs

searching dependent graphs…