File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -665,6 +665,18 @@ light blue: no ETA); as demonstrated below.
665665|Screenshot-Jupyter2 |
666666|Screenshot-Jupyter3 |
667667
668+ It is also possible to let ``tqdm `` automatically choose between
669+ console or notebook versions by using the ``autonotebook `` submodule:
670+
671+ .. code :: python
672+
673+ from tqdm.autonotebook import tqdm
674+ tqdm.pandas()
675+
676+ Note that this will issue a ``TqdmExperimentalWarning `` if run in a notebook
677+ since it is not meant to be possible to distinguish between ``jupyter notebook ``
678+ and ``jupyter console ``.
679+
668680Writing messages
669681~~~~~~~~~~~~~~~~
670682
Original file line number Diff line number Diff line change 1+ try :
2+ from IPython import get_ipython
3+ if 'IPKernelApp' not in get_ipython ().config :
4+ raise ImportError ("console" )
5+ except :
6+ from .._tqdm import tqdm , trange
7+ else :
8+ from .._tqdm_notebook import tqdm_notebook as tqdm
9+ from .._tqdm_notebook import tnrange as trange
10+ from .._tqdm import TqdmExperimentalWarning
11+ from warnings import warn
12+ warn ("Using `tqdm.autonotebook.tqdm` in notebook mode."
13+ " Use `tqdm.tqdm` instead to force console mode"
14+ " (e.g. in jupyter console)" , TqdmExperimentalWarning )
15+ __all__ = ["tqdm" , "trange" ]
You can’t perform that action at this time.
0 commit comments