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!

3
  • 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? Commented Jun 19, 2018 at 20:10
  • Have a look at How to create a hyperlink with a Label in Tkinter? and python Tkinter have displayed text as hyperlink. Commented Jun 19, 2018 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. Commented Mar 18, 2021 at 4:22

1 Answer 1

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).

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.