From 9e2ba1f08a4ee212006b61b1063b3ae4cfca7ae8 2012-08-31 11:28:31 From: Bussonnier Matthias Date: 2012-08-31 11:28:31 Subject: [PATCH] Merge pull request #2362 from hmeine/master Clean up ProgressBar class in example notebook --- diff --git a/docs/examples/notebooks/Animations_and_Progress.ipynb b/docs/examples/notebooks/Animations_and_Progress.ipynb index 601feaa..f64d7bc 100644 --- a/docs/examples/notebooks/Animations_and_Progress.ipynb +++ b/docs/examples/notebooks/Animations_and_Progress.ipynb @@ -204,25 +204,16 @@ "collapsed": true, "input": [ "import sys, time\n", - "try:\n", - " from IPython.display import clear_output\n", - " have_ipython = True\n", - "except ImportError:\n", - " have_ipython = False\n", "\n", "class ProgressBar:\n", " def __init__(self, iterations):\n", " self.iterations = iterations\n", " self.prog_bar = '[]'\n", " self.fill_char = '*'\n", - " self.width = 40\n", + " self.width = 50\n", " self.__update_amount(0)\n", - " if have_ipython:\n", - " self.animate = self.animate_ipython\n", - " else:\n", - " self.animate = self.animate_noipython\n", "\n", - " def animate_ipython(self, iter):\n", + " def animate(self, iter):\n", " print '\\r', self,\n", " sys.stdout.flush()\n", " self.update_iteration(iter + 1)\n", @@ -254,19 +245,12 @@ "input": [ "p = ProgressBar(1000)\n", "for i in range(1001):\n", + " time.sleep(0.002)\n", " p.animate(i)" ], "language": "python", "metadata": {}, "outputs": [] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [], - "language": "python", - "metadata": {}, - "outputs": [] } ], "metadata": {}