Skip to content

Commit

Permalink
only display view if in notebook env
Browse files Browse the repository at this point in the history
  • Loading branch information
hainm committed Aug 2, 2019
1 parent 644fa66 commit 9e25a50
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion nglview/color.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,11 @@ class _ColormakerRegistry(BaseWidget):

def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)
display(self)
try:
get_ipython() # only display in notebook
display(self)
except NameError:
pass

@observe("_ready")
def _on_ready(self, change):
Expand Down

0 comments on commit 9e25a50

Please sign in to comment.