A reactive notebook for Python — run reproducible experiments, query with SQL, execute as a script, deploy as an app, and version with git. Stored as pure Python. All in a modern, AI-native editor.
Python artificial-intelligencedagdata-sciencedata-visualizationdataflowdeveloper-toolsmachine-learningnotebookspipelinepythonreactivesqlweb-app
docs: outputs (#2673)
Akshay Agrawal662b41f526a6
diff --git a/docs/guides/outputs.md b/docs/guides/outputs.mdindex 391d64e799..3e951abafe 100644--- a/docs/guides/outputs.md+++ b/docs/guides/outputs.md@@ -86,7 +86,60 @@ The marimo library also comes with elements for laying out outputs, including[`mo.nav_menu`](#marimo.nav_menu), [`mo.ui.table`](#marimo.ui.table),and [many more](https://docs.marimo.io/api/layouts/index.html).+## Progress bars++Use [`mo.status.progress_bar`](#marimo.status.progress_bar) and+[`mo.status.spinner`](#marimo.status.progress_bar) to create progress indicators:++```python+# mo.status.progress_bar is similar to TQDM+for i in mo.status.progress_bar(range(10)):+ print(i)+```+## Mediamarimo comes with functions to display media, including images, audio,video, pdfs, and more. See the [API docs](/api/media/index.md) for more info.++## Imperatively adding outputs++While a cell's output is its last expression, it can at times be helpful+to imperatively add to the output area while a cell is running. marimo+provides utility functions like+[`mo.output.append`](#marimo.output.append) for accomplishing this; see the+[API docs](/api/outputs.md) for more information.++## Console Outputs++Console outputs, such as print statements, show up below a cell in the console+output area; they are not included in the output area or app view by default.++To include console outputs in the cell output area, use+[`mo.redirect_stdout`](#marimo.redirect_stdout) or+[`mo.redirect_stderr`](#marimo.redirect_stderr):++```python+with mo.redirect_stdout():+ print("Hello, world!")+```++marimo also includes utility functions for [capturing standard out](#marimo.capture_stdout) and [standard+error](#marimo.capture_stderr) without redirecting them. See the [API+docs](/api/outputs.md#console-outputs) for more.++## Threading++To create a thread that can reliably communicate outputs to the frontend,+use [`mo.Thread`](#marimo.Thread), which has exactly the same API as+as `threading.Thread`.++If you need to forward outputs from threads spawned by third-party code, try+patching `threading.Thread`:++```python+import threading+import marimo as mo++threading.Thread = mo.Thread+```