Clickable hyperlinks

Terry Reedy tjreedy at
Wed Jan 4 01:57:52 EST 2017

On 1/4/2017 4:32 AM, Deborah Swanson wrote:

> My original question was whether python had anything to provide this
> functionality, and the answer appears to be a resounding NO!!!

I would say 'Yes, but with user effort'.

To have a string interpreted as a clickable link, you send the string to 
software capable of creating a clickable link, plus the information
'this is a clickable link'*.  There are two ways to tag a string as a
link.  One is to use markup around the url in the string itself.
'<url>' and html are example.  Python provides multiple to make this
easy. The other is to tag the string with a separate argument.  Python provides 
tkinter, which wraps tk Text widgets, which have a powerful tag system.  One 
can define a Link tag that will a) cause text to be displayed, for instance, 
blue and underlined and b) cause clicks on the text to generate a web request.  
One could then use
   mytext.insert('insert', '', Link)
Browser must do something similar when they encounter when they encounter html 
link tags.

* If the software directly recognizes a bare url such as
'' as a link, without further indication, then it
should have a way to disable conversion to a clickable link.

Terry Jan Reedy

More information about the Python-list mailing list