【问题标题】:display hyperlink in Output ipywidget with link在带有链接的输出 ipywidget 中显示超链接
【发布时间】:2020-07-13 11:32:59
【问题描述】:

我想在输出 ipywidget 中添加几个链接

目前为止:

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

我明白了:

我想要: a)摆脱'' b) 获取可点击的链接

有什么想法吗?

【问题讨论】:

    标签: python output jupyter display ipywidgets


    【解决方案1】:

    除非您为每一行创建一个文本小部件,否则您无法摆脱' 标记。这正是 Python 和 IPython 显示字符串的方式。

    为了更清晰地显示您的文本和链接,请使用 ipywidgets 中的 HTML 小部件:

    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)
    

    【讨论】:

    • 您好,您知道如何设置超链接的字体大小吗?通常的布局方式似乎行不通。
    • 可以使用普通的html格式标签w3schools.com/tags/tag_font.asp
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2021-07-14
    • 2013-09-14
    • 2011-05-14
    • 2013-07-14
    • 2011-09-30
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多