# Python Console Embedded interactive Python REPL in a terminal widget. ```{raw} html ▶ Run in browser ``` **Tags:** `ui` Pairs the TerminalEmulator widget with PyConsoleNode -- an in-process Python interpreter. Unlike the bash terminal demo (which needs a real PTY and only runs on desktop), this console runs *inside* the app's own interpreter, so it works identically on desktop and in the browser via Pyodide. It also shares the live program state: the namespace below exposes the scene tree so you can poke at it. Try: - 2 ** 100 - import math; math.tau - [n.name for n in tree.root.children] - help(str) (then type q to leave the pager-free help) Controls: - Click the terminal to focus, type to interact - Left/Right/Home/End edit the line; Up/Down recall history - Ctrl+C cancels the current line; Ctrl+D (empty line) or exit() closes it Run: uv run python examples/features/ui/python_console.py ## Source ```{literalinclude} ../../examples/features/ui/python_console.py :language: python :linenos: ```