Text search and tag_add

André Dahlqvist andre at beta.telenordia.se
Tue May 30 21:12:42 EDT 2000


Hi everyone,

I am trying to mark strings that start with "http://" in a Text widget as
hyperlinks, and I have found a solution that _almost_ works:

text.tag_configure("hyperlink", foreground="blue", underline=1)
link = text.search("http://", 1.0, END)
if link:
	text.tag_add("hyperlink", link, link+"wordend"

The problem with this is that I can't get it to mark the whole link, it
stops at "://". The reason for this seams to be that these characters
are not taken to be part of the same word as "http", and therefore it
stops there.

Does anyone know of a way around this?

// André




More information about the Python-list mailing list