apostrophe not considered with tkinter's wordstart and wordend

Peter Otten __peter__ at web.de
Sat Jan 3 16:06:22 EST 2015


ravas wrote:

> When I place my mouse over a word (and I press something)
> I want the program to analyze the word.
> Tkinter almost provides the perfect option:
> self.text.get('current wordstart', 'current wordend')
> 
> Unfortunately apostrophes are not considered using wordstart and wordend.
> http://infohost.nmt.edu/tcc/help/pubs/tkinter/
> Says:
> "For the purposes of this operation, a word is either
> a string of consecutive letter, digit, or underbar (_) characters,
> or a single character that is none of these types."
> 
> The easy work around is to highlight the word and use:
> self.text.get('sel.first', 'sel.last')
> 
> However, it seems like it could be an easy improvement
> if we could include the apostrophe in the list of word characters.
> Is it possible that this could be added in an upcoming version of Python
> -- or is this a Tk issue?

I think it is.

<http://www.tcl.tk/man/tcl8.6/TkCmd/text.htm#M41> does not mention a way to 
configure the set of word chars either:

"""
?submodifier? wordstart
Adjust the index to refer to the first character of the word containing the 
current index. A word consists of any number of adjacent characters that are 
letters, digits, or underscores, or a single character that is not one of 
these. If the display submodifier is given, this only examines non-elided 
characters, otherwise all characters (elided or not) are examined.
"""





More information about the Python-list mailing list