Yaakov Bressler
Yaakov Bressler

Reputation: 12018

Icon for ipywidgets Button not working in Google colab

I'm trying to create a button with an icon using ipywidgets in Google colab without success.

import ipywidgets as widgets
from IPython.display import display

my_button = widgets.Button(icon="home")
display(my_button)

However, no icon is displayed...

Upvotes: 1

Views: 1501

Answers (1)

Yaakov Bressler
Yaakov Bressler

Reputation: 12018

The following workaround was shared with me from an open issue on github for google colab:

# Create the button
my_button = widgets.Button(icon="home")

# Display the HTML for the button
display(HTML('''<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css"> '''))
# Display the actual button
display(my_button)

Two items are overlaid – the font-awesome icon and the actual button – though rendering of the actual button isn't achieved.

Upvotes: 4

Related Questions