Marking hyperlinks in a Text widget

André Dahlqvist andre at beta.telenordia.se
Wed May 31 22:08:19 EDT 2000


> def click(event):
>     os.system("netscape -remote 'openURL(%s)'" % \
>                textw.tag_names('@%d,%d' % (event.x, event.y))[1])

Is openURL a function that you have written? If so, can I check it out?
If I understand the code above correctly textw.tag_names() in this
case returns the name of the tag associated with the text positioned 
where the mouse is. But how do you actually get the URL? I mean to 
use textw.get(...) you need to know the index of the first and last 
character in the URL we want, right?

tag_ranges seam interesting. With the help of that one I can get the
positions of all the words tagged with 'url'. What I don't understand is
how to know which of these was just clicked.

// André





More information about the Python-list mailing list