code_console.rst 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. .. _code_console:
  2. Code Consoles
  3. -------------
  4. Code consoles enable you to run code interactively in a kernel. The cells
  5. of a code console show the order in which code was executed in the
  6. kernel, as opposed to the explicit ordering of cells in a notebook
  7. document. Code consoles also display rich output, just like notebook
  8. cells.
  9. Create a new code console by clicking the ``+`` button in the :ref:`file
  10. browser <left_sidebar>` and selecting the kernel:
  11. .. raw:: html
  12. <div class="jp-youtube-video">
  13. <iframe src="https://www.youtube-nocookie.com/embed/7Sb_a6veU1s?rel=0&amp;showinfo=0" frameborder="0" allow="autoplay; encrypted-media" allowfullscreen></iframe>
  14. </div>
  15. Run code using ``Shift Enter``. Use the up and down arrows to browse the
  16. history of previously-run code:
  17. .. raw:: html
  18. <div class="jp-youtube-video">
  19. <iframe src="https://www.youtube-nocookie.com/embed/L52yh9FPAtY?rel=0&amp;showinfo=0" frameborder="0" allow="autoplay; encrypted-media" allowfullscreen></iframe>
  20. </div>
  21. Tab completion (``Tab``) and tooltips (``Shift Tab``) work as in the
  22. notebook:
  23. .. raw:: html
  24. <div class="jp-youtube-video">
  25. <iframe src="https://www.youtube-nocookie.com/embed/WoqFgmSuigE?rel=0&amp;showinfo=0" frameborder="0" allow="autoplay; encrypted-media" allowfullscreen></iframe>
  26. </div>
  27. Clear the cells of the code console without restarting the kernel by
  28. right-clicking on the code console and selecting “Clear Console Cells”:
  29. .. raw:: html
  30. <div class="jp-youtube-video">
  31. <iframe src="https://www.youtube-nocookie.com/embed/Aj7sQgP39z8?rel=0&amp;showinfo=0" frameborder="0" allow="autoplay; encrypted-media" allowfullscreen></iframe>
  32. </div>
  33. Creating a code console from the :ref:`file menu <menu_bar>` lets you select an existing
  34. kernel for the code console. The code console then acts as a log of
  35. computations in that kernel, and a place you can interactively inspect
  36. and run code in the kernel:
  37. .. raw:: html
  38. <div class="jp-youtube-video">
  39. <iframe src="https://www.youtube-nocookie.com/embed/QyRuPrLrIOs?rel=0&amp;showinfo=0" frameborder="0" allow="autoplay; encrypted-media" allowfullscreen></iframe>
  40. </div>