On Monday, January 5, 2015 2:01:22 AM UTC-6, ravas wrote: > I'm curious about what events you would use. The only work > around I thought of is to create a word list and then > apply tags & use tag_bind().
Well i'm not sure what you are doing exactly, so i'll have to take some liberties here, but i don't foresee "tag_bind" as helping you. In order to use the binding applied to a tag, you'll first have to apply the tag to the range of the text containing the "target word"... (Ahhh, the old "quid pro quo brings back a good memory!) https://www.youtube.com/watch?v=qr2bKXBV67o then and only then could you expect an event to fire. I was thinking more of binding on the "widget level". Here is what you said earlier: > 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: but [...] From *that* description, a simple binding of "<Button-1>" to a callback will give you the chance to process the "word" on the Python side. Of course, that's easier said than done my friend! O:-) Because (in your case) you cannot rely on the "TK wordstart pattern" to define the edges correctly, you'll have to capture the entire line, THEN compute the location of the cursor within the sub-string ("local offset in absolute terms"), THEN back pedal until you find the first space (or whatever defines the start of a word in your app), THEN use the re module (or some other method) to find the end of the word (if it exists at all), THEN if it does, do something. *GASP*! Of course all this could be avoided if those short- sighted TK folks would have allowed the programmer to define the pattern! ಠ_ಠ One thing to consider though: left-mouse-down is a common event for most of us --except for those few immortals among us who have sworn to a "mouse free life"[1] and have officially completed space cadet training-- and you don't want Python doing all that work for nothing! So unless you can justify all that processing for every left-mouse-down event, i would suggest using another event. [1]: Of which the phrase would make for interesting satirical replacement of the chorus in: little orphan Annie's, "it's a hard knock life". It's a mouse free life, for us... It's a mouse free life, for us... Instead of clicks, WE get pecks... It's a mouse free life! -- https://mail.python.org/mailman/listinfo/python-list