Tkinter ->> selected mouse text
Fredrik Lundh
fredrik at pythonware.com
Mon Jun 9 09:43:22 EDT 2003
jubafre at brturbo.com wrote:
> how can i get a selected text with the mouse in a
> text componnent in tkinter?? i have to get start
> position and end position of the selected text.
what's a text component? a Text widget? if so, use the
SEL_FIRST and SEL_LAST indices:
s = text.get(SEL_FIRST, SEL_LAST)
if you need the actual row/column coordinates, use the
index method to get a "row.column" index:
first = text.index(SEL_FIRST)
last = text.index(SEL_LAST)
for more info, see "concepts" and "patterns" under:
http://www.pythonware.com/library/tkinter/introduction/text.htm
</F>
More information about the Python-list
mailing list