Skip to content

Commit e53dcac

Browse files
committed
attempt to fix aliased imports as per #187
1 parent bb53160 commit e53dcac

1 file changed

Lines changed: 12 additions & 5 deletions

File tree

tqdm/_tqdm_notebook.py

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,9 @@
2121
# import IPython/Jupyter base widget and display utilities
2222
try: # IPython 4.x
2323
import ipywidgets
24+
IPY = 4
2425
except ImportError: # IPython 3.x / 2.x
26+
IPY = 32
2527
import warnings
2628
with warnings.catch_warnings():
2729
ipy_deprecation_msg = "The `IPython.html` package" \
@@ -42,14 +44,19 @@
4244
pass
4345

4446
try: # IPython 4.x / 3.x
45-
from ipywidgets import IntProgress, HBox, HTML
47+
if IPY == 32:
48+
from IPython.html.widgets import IntProgress, HBox, HTML
49+
IPY = 3
50+
else:
51+
from ipywidgets import IntProgress, HBox, HTML
4652
except ImportError:
4753
try: # IPython 2.x
48-
from ipywidgets import IntProgressWidget as IntProgress
49-
from ipywidgets import ContainerWidget as HBox
50-
from ipywidgets import HTML
54+
from IPython.html.widgets import IntProgressWidget as IntProgress
55+
from IPython.html.widgets import ContainerWidget as HBox
56+
from IPython.html.widgets import HTML
57+
IPY = 2
5158
except ImportError:
52-
pass
59+
IPY = 0
5360

5461
try:
5562
from IPython.display import display # , clear_output

0 commit comments

Comments
 (0)