1

I want to add to an output ipywidget several links

So far I do:

with wd_LINKS_output:
    display('mylinks: ')
    now= datetime.now().strftime("%Y-%m-%d %H:%M:%S")
    display(now)
    display('https://www.google.com/')

I get:

enter image description here

I would like: a) get rid of the '' b) Get a clikable link

Any ideas?

1 Answer 1

4

You can't get rid of the ' marks unless you create a Text Widget for each line. That is just the way Python and IPython displays strings.

For a cleaner display of your text and links, use the HTML Widget in ipywidgets:

import ipywidgets as widgets

text = widgets.HTML('Hyperlink below:')
link = widgets.HTML(
    value="<a href=http://www.google.com target='_blank'>Go to Google</a>",
)

display(text)
display(link)
Sign up to request clarification or add additional context in comments.

2 Comments

Hi, do you know how I can set the font-size of the hyperlink? The usual layout way doesn't appear to work out.
You can use normal html formatting tags w3schools.com/tags/tag_font.asp

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.