0

I'm trying to create a more helpful experience to a user by providing links to pages that may be the source of some kind of error.

Basically, I'm dealing with an issue where if a user tries to change their hostname for a service to the same name as an external URL they have defined in that same service.

If there is a match (meaning the entered value is a duplicate and therefore invalid) I want to raise an error message and hyperlink to the application in question so that they can immediately change it.

However, because this error message is displayed after an exception is raised and within a .py file, I'm having trouble with how to hyperlink that text without using HTML.

Any help would be appreciated!

  • What do you mean by "hyperlink that text without using HTML"? Is this a script you run on the console? A tkinter or PyQt or whatever GUI app? A Flask or Django or whatever web service? Something else? – abarnert Jun 19 '18 at 20:10
  • Have a look at [How to create a hyperlink with a Label in Tkinter?](https://stackoverflow.com/questions/23482748/how-to-create-a-hyperlink-with-a-label-in-tkinter) and [python Tkinter have displayed text as hyperlink](https://stackoverflow.com/questions/49353034/python-tkinter-have-displayed-text-as-hyperlink/49353205#49353205). – figbeam Jun 19 '18 at 20:25
  • This is ambiguously worded, but I'm guessing the intent is to have some words be a hyperlink (not possible in a cross platform manner). But I don't understand why just including a URL to act as hyperlink with a message before or after - if you include a proper URL the user will be able to click it in a few cases (eg Jupyter or many terminals) and copy paste it for platforms that don't. – Neil Mar 18 '21 at 04:22

1 Answers1

0

Assuming the error is displayed in a console window: this isn't possible in the native Windows/Unix command prompt. Several other terminal emulators, however, support links; Gnome Terminal, for example, and Conemu for Windows. If you really needed hyperlinks in your terminal, you could package one of those into your program or even make your own command-line GUI.

A much more reasonable option, however, would be to simply catch errors with a watcher process and display a simple GUI error message with hyperlinks included (you could use PyQT).

jman005
  • 128
  • 7