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)
| 3787 | self._w, 'compare', index1, op, index2)) |
| 3788 | |
| 3789 | def count(self, index1, index2, *options, return_ints=False): # new in Tk 8.5 |
| 3790 | """Counts the number of relevant things between the two indices. |
| 3791 | |
| 3792 | If INDEX1 is after INDEX2, the result will be a negative number |
| 3793 | (and this holds for each of the possible options). |
| 3794 | |
| 3795 | The actual items which are counted depends on the options given. |
| 3796 | The result is a tuple of integers, one for the result of each |
| 3797 | counting option given, if more than one option is specified or |
| 3798 | return_ints is false (default), otherwise it is an integer. |
| 3799 | Valid counting options are "chars", "displaychars", |
| 3800 | "displayindices", "displaylines", "indices", "lines", "xpixels" |
| 3801 | and "ypixels". The default value, if no option is specified, is |
| 3802 | "indices". There is an additional possible option "update", |
| 3803 | which if given then all subsequent options ensure that any |
| 3804 | possible out of date information is recalculated. |
| 3805 | """ |
| 3806 | options = ['-%s' % arg for arg in options] |
| 3807 | res = self.tk.call(self._w, 'count', *options, index1, index2) |
| 3808 | if not isinstance(res, int): |
| 3809 | res = self._getints(res) |
| 3810 | if len(res) == 1: |
| 3811 | res, = res |
| 3812 | if not return_ints: |
| 3813 | if not res: |
| 3814 | res = None |
| 3815 | elif len(options) <= 1: |
| 3816 | res = (res,) |
| 3817 | return res |
| 3818 | |
| 3819 | def debug(self, boolean=None): |
| 3820 | """Turn on the internal consistency checks of the B-Tree inside the text |