mirror of https://github.com/tqdm/tqdm.git
tqdm.autonotebook
- adds documentation and `pandas()` example (#474) - closes #443
This commit is contained in:
parent
0307fd18eb
commit
97a9393274
12
README.rst
12
README.rst
|
@ -665,6 +665,18 @@ light blue: no ETA); as demonstrated below.
|
|||
|Screenshot-Jupyter2|
|
||||
|Screenshot-Jupyter3|
|
||||
|
||||
It is also possible to let ``tqdm`` automatically choose between
|
||||
console or notebook versions by using the ``autonotebook`` submodule:
|
||||
|
||||
.. code:: python
|
||||
|
||||
from tqdm.autonotebook import tqdm
|
||||
tqdm.pandas()
|
||||
|
||||
Note that this will issue a ``TqdmExperimentalWarning`` if run in a notebook
|
||||
since it is not meant to be possible to distinguish between ``jupyter notebook``
|
||||
and ``jupyter console``.
|
||||
|
||||
Writing messages
|
||||
~~~~~~~~~~~~~~~~
|
||||
|
||||
|
|
|
@ -0,0 +1,15 @@
|
|||
try:
|
||||
from IPython import get_ipython
|
||||
if 'IPKernelApp' not in get_ipython().config:
|
||||
raise ImportError("console")
|
||||
except:
|
||||
from .._tqdm import tqdm, trange
|
||||
else:
|
||||
from .._tqdm_notebook import tqdm_notebook as tqdm
|
||||
from .._tqdm_notebook import tnrange as trange
|
||||
from .._tqdm import TqdmExperimentalWarning
|
||||
from warnings import warn
|
||||
warn("Using `tqdm.autonotebook.tqdm` in notebook mode."
|
||||
" Use `tqdm.tqdm` instead to force console mode"
|
||||
" (e.g. in jupyter console)", TqdmExperimentalWarning)
|
||||
__all__ = ["tqdm", "trange"]
|
Loading…
Reference in New Issue