steve+python at pearwood.info
Wed Jan 4 04:20:28 EST 2017
On Wed, 4 Jan 2017 03:46 pm, Deborah Swanson wrote:
> As I've mentioned in other posts on this thread, I'm now thinking that I
> need to write a class to do this, and find out how Firefox and url aware
> terminals in Linux do it. There must be a way.
A GUI application can interpret text any way it chooses. Firefox takes a HTML
file and renders it, using whatever GUI library it chooses. That GUI
library understands that text like:
should be shown in bold face, and text like:
should be shown as the word "Example" underlined and in some colour, and when
you click on it the browser will navigate to the URL given. Firefox can do this
because it controls the environment it runs in.
Same for Excel, which also controls the environment it runs in.
That's *not* the case for Python, which is at the mercy of whatever console or
terminal application it is running in.
However, you can use Python to write GUI applications. Then it becomes
*your* responsibility to create the window, populate it with any buttons or
text or scroll bars you want, and you can choose to interpret text any way you
like -- including as clickable Hyperlinks.
The bottom line is, there is no "a way" to do this. There are a thousand, ten
thousand, ways to do it. Every web browser, every terminal, every URL-aware
application, can choose its own way to do it. There's no one
single way that works everywhere, but if you are working in a console or
terminal, just printing the URL is likely to be interpreted by the console as a
â £Cheer up,â Ø they said, â £things could be worse.â Ø So I cheered up, and
enough, things got worse.
More information about the Python-list