Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.002 X-Spam-Evidence: '*H*': 1.00; '*S*': 0.00; 'subject:not': 0.03; 'configure': 0.05; '"""': 0.07; 'mouse': 0.07; 'tkinter': 0.07; 'string': 0.09; 'received:80.91': 0.09; 'received:80.91.229': 0.09; 'received:gmane.org': 0.09; 'received:list': 0.09; 'python': 0.11; 'adjacent': 0.16; 'apostrophes': 0.16; 'given,': 0.16; 'highlight': 0.16; 'index.': 0.16; 'issue?': 0.16; 'operation,': 0.16; 'option:': 0.16; 'received:80.91.229.3': 0.16; 'received:dip0.t-ipconnect.de': 0.16; 'received:plane.gmane.org': 0.16; 'received:t-ipconnect.de': 0.16; 'underscores,': 0.16; 'index': 0.16; 'wrote:': 0.18; 'seems': 0.21; 'header:User- Agent:1': 0.23; 'mention': 0.26; 'purposes': 0.26; 'url:edu': 0.26; 'header:X-Complaints-To:1': 0.27; 'character': 0.29; 'characters': 0.30; 'skip:? 10': 0.33; 'could': 0.34; 'subject:with': 0.35; 'display': 0.35; 'version': 0.36; 'adjust': 0.36; 'possible': 0.36; 'list': 0.37; 'to:addr:python-list': 0.38; 'does': 0.39; 'to:addr:python.org': 0.39; 'either': 0.39; 'received:org': 0.40; 'skip:u 10': 0.60; 'easy': 0.60; 'analyze': 0.60; 'consists': 0.60; 'is.': 0.60; 'first': 0.61; 'refer': 0.63; 'url:help': 0.67; 'containing': 0.69; 'press': 0.70; 'characters,': 0.84; 'improvement': 0.84; 'either:': 0.91; 'these.': 0.91; 'url:tk': 0.95 X-Injected-Via-Gmane: http://gmane.org/ To: python-list@python.org From: Peter Otten <__peter__@web.de> Subject: Re: apostrophe not considered with tkinter's wordstart and wordend Date: Sat, 03 Jan 2015 22:06:22 +0100 Organization: None References: Mime-Version: 1.0 Content-Type: text/plain; charset="ISO-8859-1" Content-Transfer-Encoding: 7Bit X-Gmane-NNTP-Posting-Host: p57bd9b8f.dip0.t-ipconnect.de User-Agent: KNode/4.13.3 X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Newsgroups: comp.lang.python Message-ID: Lines: 37 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1420319198 news.xs4all.nl 2869 [2001:888:2000:d::a6]:33109 X-Complaints-To: abuse@xs4all.nl Path: csiph.com!usenet.pasdenom.info!bete-des-vosges.org!feed.ac-versailles.fr!nerim.net!novso.com!newsfeed.xs4all.nl!newsfeed3a.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail Xref: csiph.com comp.lang.python:83180 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. 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. """