Clickable hyperlinks

Deborah Swanson python at deborahswanson.net
Wed Jan 4 06:43:02 EST 2017


Steve D'Aprano wrote, on January 04, 2017 2:39 AM
> 
> On Wed, 4 Jan 2017 08:32 pm, Deborah Swanson wrote:
> 
> > Thanks, Steven. Yes, of course if you want to print strings 
> you must 
> > enclose them in quotes. I think you learn that in Week 1 of any 
> > introductory course on Python.
> > 
> > But we aren't trying to print strings here, the point is to produce 
> > clickable links. I didn't enclose them with quotes because I didn't 
> > see any point in printing plain text when I wanted 
> clickable links. I 
> > actually didn't understand why you thought I should print 
> them, but it 
> > never would have occurred to me that you wanted me to print out a 
> > bunch of silly plain text strings, apparently just for the 
> heck of it.
> 
> What we have here is a failure to communicate :-)
> 
> I apologise for ruffling your feathers, but its difficult to 
> judge another person's level of knowledge. In someways you're 
> obviously quite knowledgeable about Python, but in other ways 
> you're still learning (as we all are!) and I'm afraid I may 
> have misjudged exactly what your level of knowledge was. 
> Sorry about that.
> 
> I'm not suggesting that you print "silly plain text strings" 
> just for the heck of it. You've asked how to get a clickable 
> link using Python. There is only one way I know of to get a 
> clickable link using Python:
> 
> Write out a link as plain text to another application which 
> then interprets the plain text as a clickable link.
> 
> You *might* be able to get clickable links in Python by 
> writing an entire GUI application, using (say) the tkinter 
> library, or one of the third-party GUI libraries like 
> wxPython, kivy, pyqt, or others, but I haven't a clue how. 
> But even there, your links will start off as text, which 
> means you will still need to surround them with quotes to 
> make them strings.
> 
> 
> Aside: you've actually raised a fascinating question. I 
> wonder whether there are any programming languages that 
> understand URLs as native data types, so that *source code* 
> starting with http:// etc is understood in the same way that 
> source code starting with [ is seen as a list or { as a dict?
> 
> 
> But back to your problem: short of writing you own GUI 
> application, in which case you can do *anything you like*, you can:
> 
> - write out a HTML file containing the URLs you want, in <a 
> href= ... </a> tags, then open the HTML file in a web browser 
> and let the web browser interpret the HTML tags as clickable links;
> 
> 
> - write out an Excel spreadsheet, using whatever format Excel 
> expects, open the spreadsheet in Excel, and let Excel 
> interpret the mystery format as a clickable link;
> 
> - print the URL to the console, and see if the console is 
> smart enough to interpret it as a clickable link.
> 
> 
> I'm sorry that I can't give you a one-sentence answer "just 
> use such-and-such a function, that does exactly what you want 
> in a platform-independent manner" :-(
> 
> 
> 
> 
> -- 
> Steve
> "Cheer up," they said, "things could be worse." So I cheered 
> up, and sure enough, things got worse.

Well, well. People mix and people misunderstand and misjudge each other.
It's the way of things with people. I just needed to tell you how it all
looked from my side.  So are we done with that?  I certainly hope so.

I'm quite well aware by now that there is no one-sentence answer to my
original question, if there's any coherent answer at all. Them's the
breaks. Live with it or live without it, it doesn't care.

I do appreciate the education I've gotten on this thread about the
issues involved. But I rather imagine that near term anyway, I'll only
be pondering it now and then, and maybe poking around a bit. Who knows,
maybe I'll eventually invent the solution and make my first million
dollars from it.  haha, yeah right.

So it goes.


Deborah





More information about the Python-list mailing list