Counts the number of relevant things between the two indices. If INDEX1 is after INDEX2, the result will be a negative number (and this holds for each of the possible options). The actual items which are counted depends on the options given. The result is a tuple of
(self, index1, index2, *options, return_ints=False)
| 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] |
| 3889 | res = self.tk.call(self._w, 'count', *options, index1, index2) |
| 3890 | if not isinstance(res, int): |
| 3891 | res = self._getints(res) |
| 3892 | if len(res) == 1: |
| 3893 | res, = res |
| 3894 | if not return_ints: |
| 3895 | if not res: |
| 3896 | res = None |
| 3897 | elif len(options) <= 1: |
| 3898 | res = (res,) |
| 3899 | return res |
| 3900 | |
| 3901 | def debug(self, boolean=None): |
| 3902 | """Turn on the internal consistency checks of the B-Tree inside the text |