diff --git a/nglview/color.py b/nglview/color.py index b933510c..f3f627e2 100644 --- a/nglview/color.py +++ b/nglview/color.py @@ -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):