I’m working on a console application. My application uses urwid lib. In some cases, I need to show very long hyperlinks as short text inside table columns. I want to open links in the browser when I click on the text inside the column.
So, my question is:
It is possible to print text as a hyperlink to the console?
Can you provide a small example of how to print text as a hyperlink using python?
Advertisement
Answer
Yes, using some tools, like gNewt or Curses, you could create a button and ‘on click’ do an action (like open a browser to a given url).
gNewt : http://gnewt.sourceforge.net/
nCurses : https://docs.python.org/3.7/library/curses.html
Otherwise, it’s the terminal application that will manage the text you give it, and if it doesn’t implement uri’s recognition your program won’t work as you’d like.