From 9a5a28b2c27aefac32ffa11f68ee7db3d3857862 2013-09-20 18:46:09
From: Jonathan Frederic <jdfreder@calpoly.edu>
Date: 2013-09-20 18:46:09
Subject: [PATCH] Updated clear_output animation example nb

---

diff --git a/examples/notebooks/Animations Using clear_output.ipynb b/examples/notebooks/Animations Using clear_output.ipynb
index f3de1c9..c799dfb 100644
--- a/examples/notebooks/Animations Using clear_output.ipynb
+++ b/examples/notebooks/Animations Using clear_output.ipynb
@@ -21,7 +21,7 @@
      "source": [
       "Sometimes you want to clear the output area in the middle of a calculation.  This can be useful for doing simple animations. In terminals, there is the carriage-return (`'\\r'`) for overwriting a single line, but the notebook frontend can clear the whole output area, not just a single line.\n",
       "\n",
-      "To clear output in the Notebook you can use the `clear_output` function."
+      "To clear output in the Notebook you can use the `clear_output()` function.  If you are clearing the output every frame of an animation, calling `clear_output()` will create noticeable flickering.  You can use `clear_output(wait=True)` to add the *clear_output* call to a queue.  When data becomes available to replace the existing output, the *clear_output* will be called immediately before the new data is added.  This avoids the flickering by not rendering the cleared output to the screen."
      ]
     },
     {
@@ -58,7 +58,7 @@
       "from IPython.display import display, clear_output\n",
       "for i in range(10):\n",
       "    time.sleep(0.25)\n",
-      "    clear_output()\n",
+      "    clear_output(wait=True)\n",
       "    print(i)\n",
       "    sys.stdout.flush()"
      ],
@@ -166,7 +166,7 @@
       "for n in range(1,10):\n",
       "    time.sleep(1)\n",
       "    ax.plot(x, jn(x,n))\n",
-      "    clear_output()\n",
+      "    clear_output(wait=True)\n",
       "    display(f)\n",
       "\n",
       "# close the figure at the end, so we don't get a duplicate\n",