# Python TUI libraries

Python TUI libraries build interactive interfaces that run inside a terminal, from single prompts to full-screen applications. A framework draws widgets with text characters and reads keyboard and mouse input from the terminal. These libraries let command-line tools and developer utilities offer menus, forms, and dashboards without a graphical window.

## Popularity

| Library | Monthly downloads | Stars | Last release | License |
| --- | --- | --- | --- | --- |
| [Rich](#rich) | 575.1M | 57.8K | Apr 2026 | MIT |
| [prompt_toolkit](#prompt-toolkit) | 225.0M | 10.6K | Jul 2026 | BSD-3-Clause |
| [Textual](#textual) | 59.3M | 37.7K | Jun 2026 | MIT |
| [Questionary](#questionary) | 30.0M | 2.2K | Aug 2025 | MIT |
| [InquirerPy](#inquirerpy) | 15.3M | 484 | Jun 2022 | MIT |
| [Blessed](#blessed) | 11.6M | 1.5K | Oct 2026 | MIT |
| [Urwid](#urwid) | 5.4M | 3.0K | Nov 2026 | LGPL-2.1 |
| [python-inquirer](#inquirer) | 4.3M | 1.1K | Aug 2025 | MIT |

Downloads: PyPI, last thirty days. Stars and releases: GitHub. Amber: no release in over a year.

[Rich](#rich) has the most monthly downloads in this comparison, at 575.1M, a count that covers all its terminal output formatting.

## Capabilities

| Library | Interactive widget layouts | Questionnaire-by-dictionary API |
| --- | --- | --- |
| [Rich](#rich) | No | No |
| [prompt_toolkit](#prompt-toolkit) | Yes | No |
| [Textual](#textual) | Yes | No |
| [Questionary](#questionary) | No | Yes |
| [InquirerPy](#inquirerpy) | No | Yes |
| [Blessed](#blessed) | No | No |
| [Urwid](#urwid) | Yes | No |
| [python-inquirer](#inquirer) | No | Yes |

## Libraries

### Rich

[GitHub](https://github.com/Textualize/rich) · [PyPI](https://pypi.org/project/rich) · [Docs](https://rich.readthedocs.io/en/stable/prompt.html)

Renders rich text, tables, progress bars, syntax highlighting, and Markdown in the terminal.

- Downloads / mo: 575.1M
- Stars: 57.8K
- Last release: 15.0.0
- License: MIT
- Capabilities: [From the Rich docs](https://rich.readthedocs.io/en/stable/prompt.html)

```sh
python -m pip install rich
```

**cookiecutter/cookiecutter** (25.2K stars)

[cookiecutter/cookiecutter](https://github.com/cookiecutter/cookiecutter) 

```python
def read_user_variable(var_name: str, default_value, prompts=None, prefix: str = ""):
    """Prompt user for variable and return the entered value or given default.

    :param str var_name: Variable of the context to query the user
    :param default_value: Value that will be returned if no input happens
    """
    question = (
        prompts[var_name]
        if prompts and var_name in prompts and prompts[var_name]
        else var_name
    )

    while True:
        variable = Prompt.ask(f"{prefix}{question}", default=default_value)
        if variable is not None:
            break

    return variable

```

[cookiecutter/prompt.py](https://github.com/cookiecutter/cookiecutter/blob/c88fbe921c97c58b65f1883ba90a0ab53cc91b34/cookiecutter/prompt.py#L25-L42) · [More projects using Rich →](https://dashboard.exa.ai/playground/search?q=rich%20GitHub%20projects)

**Quickstart**

```python
from rich.prompt import Prompt
name = Prompt.ask("Enter your name")

```

From [prompt.rst](https://rich.readthedocs.io/en/stable/prompt.html)

### prompt_toolkit

[GitHub](https://github.com/prompt-toolkit/python-prompt-toolkit) · [PyPI](https://pypi.org/project/prompt-toolkit) · [Docs](https://python-prompt-toolkit.readthedocs.io/en/master/)

Builds interactive prompts and full-screen terminal applications.

- Downloads / mo: 225.0M
- Stars: 10.6K
- Last release: 3.0.53
- License: BSD-3-Clause
- Capabilities: [From the prompt_toolkit docs](https://python-prompt-toolkit.readthedocs.io/en/master/)

**Strengths**

- **Supports Emacs and Vi editing.** Offer familiar Emacs or Vi key bindings in terminal inputs.
- **Uses asyncio natively.** Run terminal applications on Python’s asyncio event loop.

**Watch out for**

- **Pygments supplies language highlighting.** Add Pygments, a syntax-highlighting library, for its ready-made language lexers.
- **Existing async apps need run_async.** Call run_async() inside applications that already use asyncio.

```sh
pip install prompt_toolkit
```

**dbcli/pgcli** (13.5K stars)

[dbcli/pgcli](https://github.com/dbcli/pgcli) 

```python
def _build_cli(self, history):
    key_bindings = pgcli_bindings(self)

    def get_message():
        if self.dsn_alias and self.prompt_dsn_format is not None:
            prompt_format = self.prompt_dsn_format
        else:
            prompt_format = self.prompt_format

        prompt = self.get_prompt(prompt_format)

        if prompt_format == self.default_prompt and len(prompt) > self.max_len_prompt:
            prompt = self.get_prompt("\\d> ")

        prompt = prompt.replace("\\x1b", "\x1b")
        return ANSI(prompt)

    def get_continuation(width, line_number, is_soft_wrap):
        continuation = self.multiline_continuation_char * (width - 1) + " "
        return [("class:continuation", continuation)]

    get_toolbar_tokens = create_toolbar_tokens_func(self)

    if self.wider_completion_menu:
        complete_style = CompleteStyle.MULTI_COLUMN
    else:
        complete_style = CompleteStyle.COLUMN

    with self._completer_lock:
        prompt_app = PromptSession(
            lexer=PygmentsLexer(PostgresLexer),
            reserve_space_for_menu=self.min_num_menu_lines,
            message=get_message,
            prompt_continuation=get_continuation,
            bottom_toolbar=get_toolbar_tokens if self.show_bottom_toolbar else None,
            complete_style=complete_style,
            input_processors=[
                # Highlight matching brackets while editing.
                ConditionalProcessor(
                    processor=HighlightMatchingBracketProcessor(chars="[](){}"),
                    filter=HasFocus(DEFAULT_BUFFER) & ~IsDone(),
                ),
                # Render \t as 4 spaces instead of "^I"
                TabsProcessor(char1=" ", char2=" "),
            ],
            auto_suggest=AutoSuggestFromHistory() if self.auto_suggest else None,
            tempfile_suffix=".sql",
            # N.b. pgcli's multi-line mode controls submit-on-Enter (which
            # overrides the default behaviour of prompt_toolkit) and is
            # distinct from prompt_toolkit's multiline mode here, which
            # controls layout/display of the prompt/buffer
            multiline=True,
            history=history,
            completer=ThreadedCompleter(DynamicCompleter(lambda: self.completer)),
            complete_while_typing=True,
            style=style_factory(self.syntax_style, self.cli_style),
            include_default_pygments_style=False,
            key_bindings=key_bindings,
            enable_open_in_editor=True,
            enable_system_prompt=True,
            enable_suspend=True,
            editing_mode=EditingMode.VI if self.vi_mode else EditingMode.EMACS,
            search_ignore_case=True,
            cursor=ModalCursorShapeConfig() if self.vi_mode else None,
        )

        return prompt_app

```

[pgcli/main.py](https://github.com/dbcli/pgcli/blob/dc9ce9447e0fc005a347b75b7eb5d541e282b1c1/pgcli/main.py#L1261-L1327) · [More projects using prompt_toolkit →](https://dashboard.exa.ai/playground/search?q=Python%20projects%20that%20use%20prompt-toolkit&filters=%7B%22type%22%3A%20%22auto%22%2C%20%22numResults%22%3A%2010%2C%20%22includeDomains%22%3A%20%5B%22github.com%22%5D%7D)

**Quickstart**

```python
from prompt_toolkit import prompt

text = prompt("Give me some input: ")
print(f"You said: {text}")

```

From [hello-world.py](https://python-prompt-toolkit.readthedocs.io/en/master/pages/getting_started.html)

### Textual

[GitHub](https://github.com/Textualize/textual) · [PyPI](https://pypi.org/project/textual) · [Docs](https://textual.textualize.io/)

Builds terminal interfaces with nested widgets and CSS layouts.

- Downloads / mo: 59.3M
- Stars: 37.7K
- Last release: 8.2.8
- License: MIT
- Capabilities: [From the Textual docs](https://textual.textualize.io/)

**Strengths**

- **Positions widgets with CSS layouts.** Arrange nested widgets with vertical, horizontal, and grid layouts.
- **Awaits asynchronous message handlers.** Use async handlers to call asynchronous APIs.

**Watch out for**

- **TextArea highlighting needs extra packages.** Install textual’s syntax extra before enabling TextArea highlighting.
- **Slow handlers can block input.** Move slow network calls out of message handlers.

```sh
pip install textual
```

**darrenburns/posting** (12.6K stars)

[darrenburns/posting](https://github.com/darrenburns/posting) 

```python
def compose(self) -> ComposeResult:
    self.key_input.add_class("key-input")
    self.value_input.add_class("value-input")
    with Vertical(id="row-writer-footer"):
        yield Label(
            "Editing row. Press [i]escape[/i] to cancel.", id="editing-row-label"
        )
        with Horizontal(id="key-value-inputs"):
            yield self.key_input
            yield self.value_input
            add_button = Button(self.button_label, disabled=True, id="add-button")
            add_button.can_focus = False
            yield add_button

```

[src/posting/widgets/key_value.py](https://github.com/darrenburns/posting/blob/32c45669032342cf9b95d5758af47a0d93de0ad7/src/posting/widgets/key_value.py#L52-L64) · [More projects using Textual →](https://dashboard.exa.ai/playground/search?q=Python%20projects%20that%20use%20textual&filters=%7B%22type%22%3A%20%22auto%22%2C%20%22numResults%22%3A%2010%2C%20%22includeDomains%22%3A%20%5B%22github.com%22%5D%7D)

**Quickstart**

```python
from textual.app import App

class MyApp(App):
    pass

if __name__ == "__main__":
    app = MyApp()
    app.run()

```

From [app.md](https://textual.textualize.io/guide/app/)

### Questionary

[GitHub](https://github.com/tmbo/questionary) · [PyPI](https://pypi.org/project/questionary) · [Docs](https://questionary.readthedocs.io/en/stable/pages/quickstart.html)

Builds command-line user prompts.

- Downloads / mo: 30.0M
- Stars: 2.2K
- Last release: 2.1.1
- License: MIT
- Capabilities: [From the Questionary docs](https://questionary.readthedocs.io/en/stable/pages/quickstart.html)

```sh
pip install questionary
```

**commitizen-tools/commitizen** (3.6K stars)

[commitizen-tools/commitizen](https://github.com/commitizen-tools/commitizen) 

```python
def _get_message_by_prompt_commit_questions(self) -> str:
    # Prompt user for the commit message
    questions = self.cz.questions()
    for question in (q for q in questions if q["type"] == "list"):
        question["use_shortcuts"] = self.config.settings["use_shortcuts"]
    try:
        answers = questionary.prompt(questions, style=self.cz.style)
    except ValueError as err:
        root_err = err.__context__
        if isinstance(root_err, CzException):
            raise CustomError(str(root_err))
        raise err

    if not answers:
        raise NoAnswersError()

    message = self.cz.message(answers)
    self._validate_subject_length(message)
    message = self._wrap_body(message)
    return message

```

[commitizen/commands/commit.py](https://github.com/commitizen-tools/commitizen/blob/33c248e4d21fa67d312991d96b038ab71be3039b/commitizen/commands/commit.py#L70-L89) · [More projects using Questionary →](https://dashboard.exa.ai/playground/search?q=questionary%20GitHub%20projects)

**Quickstart**

```python
import questionary

answer = questionary.text("What's your first name").ask()

```

From [quickstart.rst](https://questionary.readthedocs.io/en/stable/pages/quickstart.html)

### InquirerPy

[GitHub](https://github.com/kazhala/InquirerPy) · [PyPI](https://pypi.org/project/inquirerpy) · [Docs](https://inquirerpy.readthedocs.io/en/latest/)

Ports the Inquirer.js collection of interactive command-line interfaces to Python.

- Downloads / mo: 15.3M
- Stars: 484
- Last release: 0.3.4
- License: MIT
- Capabilities: [From the InquirerPy docs](https://inquirerpy.readthedocs.io/en/latest/)

```sh
pip3 install InquirerPy
```

**polarsource/polar** (10.5K stars)

[polarsource/polar](https://github.com/polarsource/polar) 

```python
def _ask_autodetect() -> bool:
    """Keyboard select: auto-detect URLs from the diff, or enter them manually.

    Falls back to a y/n prompt when there's no TTY or InquirerPy is missing.
    """
    if sys.stdin.isatty():
        try:
            from InquirerPy import inquirer
            from InquirerPy.base.control import Choice

            return inquirer.select(
                message="How should we pick the URLs to test?",
                choices=[
                    Choice(value=True, name="Automagic detection (based on the git diff)"),
                    Choice(value=False, name="Enter URLs manually"),
                ],
                default=True,
            ).execute()
        except Exception:
            pass
    return Confirm.ask(
        "Auto-detect URLs to test from the git diff?", default=False
    )

```

[dev/cli/commands/snap.py](https://github.com/polarsource/polar/blob/8601000dbd9ce137db01ad4afce93d65f1bdeab0/dev/cli/commands/snap.py#L242-L264) · [More projects using InquirerPy →](https://dashboard.exa.ai/playground/search?q=inquirerpy%20GitHub%20projects)

**Quickstart**

```python
from InquirerPy import inquirer

name = inquirer.text(message="What's your name:").execute()

```

From [README.md](https://raw.githubusercontent.com/kazhala/InquirerPy/0.3.4/README.md)

### Blessed

[GitHub](https://github.com/jquast/blessed) · [PyPI](https://pypi.org/project/blessed) · [Docs](https://blessed.readthedocs.io/en/latest/intro.html)

Provides a well-documented interface for making terminal apps.

- Downloads / mo: 11.6M
- Stars: 1.5K
- Last release: 1.52.0
- License: MIT
- Capabilities: [From the Blessed docs](https://blessed.readthedocs.io/en/latest/intro.html)

```sh
pip install blessed
```

**dalibo/pg_activity** (3.1K stars)

[dalibo/pg_activity](https://github.com/dalibo/pg_activity) 

```python
def boxed(
    term: Terminal,
    content: str,
    *,
    border: bool = True,
    border_color: str = "white",
    center: bool = False,
    width: int | None = None,
) -> str:
    if border:
        border_width = term.length(content) + 2
        border_formatter = getattr(term, border_color)
        lines = [
            border_formatter("┌" + "─" * border_width + "┐"),
            " ".join(
                [border_formatter("│") + term.normal, content, border_formatter("│")]
            ),
            border_formatter("└" + "─" * border_width + "┘") + term.normal,
        ]
    else:
        # border is disabled in UI tests.
        lines = ["", content, ""]
    if center:
        if width is None:
            width = term.width
        lines = [term.center(line, width=width) for line in lines]
    return "\n".join(lines)

```

[pgactivity/widgets.py](https://github.com/dalibo/pg_activity/blob/dd060aeebbacd9e2cf1ebe66df8736cae553c932/pgactivity/widgets.py#L6-L32) · [More projects using Blessed →](https://dashboard.exa.ai/playground/search?q=blessed%20GitHub%20projects)

**Quickstart**

```python
from blessed import Terminal

term = Terminal()

print(term.home + term.clear + term.move_y(term.height // 2))
print(term.black_on_darkkhaki(term.center('press any key to continue.')))

with term.cbreak(), term.hidden_cursor():
    inp = term.inkey()

print(term.move_down(2) + 'You pressed ' + term.bold(repr(inp)))

```

From [intro.rst](https://blessed.readthedocs.io/en/latest/intro.html)

### Urwid

[GitHub](https://github.com/urwid/urwid) · [PyPI](https://pypi.org/project/urwid) · [Docs](https://urwid.org/tutorial/index.html)

Builds console interfaces from nested terminal widgets.

- Downloads / mo: 5.4M
- Stars: 3.0K
- Last release: 5.1.3
- License: LGPL-2.1
- Capabilities: [From the Urwid docs](https://urwid.org/tutorial/index.html)

**Strengths**

- **Nests layouts and keyboard focus.** Divide space between widgets and manage focus within nested containers.
- **Integrates with multiple event loops.** Connect the interface to asyncio or another supported event loop.

**Watch out for**

- **Extra mouse buttons are unreliable.** Prefer left-click actions over right-click and modifier-click interactions.

```sh
pip install urwid
```

**pazz/alot** (749 stars)

[pazz/alot](https://github.com/pazz/alot) 

```python
def __init__(self, attachment, selectable=True):
    self._selectable = selectable
    self.attachment = attachment
    if not isinstance(attachment, Attachment):
        self.attachment = Attachment(self.attachment)
    att = settings.get_theming_attribute('thread', 'attachment')
    focus_att = settings.get_theming_attribute('thread',
                                               'attachment_focus')
    widget = urwid.AttrMap(urwid.Text(self.attachment.__str__()),
                           att, focus_att)
    urwid.WidgetWrap.__init__(self, widget)

```

[alot/widgets/globals.py](https://github.com/pazz/alot/blob/6baf75105903994921679025b63baf6f3be68c2a/alot/widgets/globals.py#L22-L32) · [More projects using Urwid →](https://dashboard.exa.ai/playground/search?q=Python%20projects%20that%20use%20urwid&filters=%7B%22type%22%3A%20%22auto%22%2C%20%22numResults%22%3A%2010%2C%20%22includeDomains%22%3A%20%5B%22github.com%22%5D%7D)

**Quickstart**

```python
from __future__ import annotations

import urwid

txt = urwid.Text("Hello World")
fill = urwid.Filler(txt, "top")
loop = urwid.MainLoop(fill)
loop.run()

```

From [index.html](https://raw.githubusercontent.com/urwid/urwid/master/docs/tutorial/minimal.py)

### python-inquirer

[GitHub](https://github.com/magmax/python-inquirer) · [PyPI](https://pypi.org/project/inquirer) · [Docs](https://python-inquirer.readthedocs.io/en/latest/)

Provides a collection of interactive command-line interfaces based on Inquirer.js.

- Downloads / mo: 4.3M
- Stars: 1.1K
- Last release: 3.4.1
- License: MIT
- Capabilities: [From the python-inquirer docs](https://python-inquirer.readthedocs.io/en/latest/)

```sh
pip install inquirer
```

**tuya-cloudcutter/tuya-cloudcutter** (2.0K stars)

[tuya-cloudcutter/tuya-cloudcutter](https://github.com/tuya-cloudcutter/tuya-cloudcutter) 

```python
def ask_options(text, options):
    res = inquirer.prompt(
        [
            inquirer.List(
                "result",
                carousel=True,
                message=text,
                choices=options,
            )
        ], theme=inquirer.themes.load_theme_from_dict({ "List": { "selection_color": "underline", "selection_cursor": "►" } })
    )
    if res is None:
        # Ctrl+C
        exit(1)
    return res["result"]

```

[src/get_input.py](https://github.com/tuya-cloudcutter/tuya-cloudcutter/blob/ad36091ff54bcb8391961369ae414f7aef9808fa/src/get_input.py#L39-L53) · [More projects using python-inquirer →](https://dashboard.exa.ai/playground/search?q=inquirer%20GitHub%20projects)

**Quickstart**

```python
import inquirer
questions = [
  inquirer.List('size',
                message="What size do you need?",
                choices=['Jumbo', 'Large', 'Standard', 'Medium', 'Small', 'Micro'],
            ),
]
answers = inquirer.prompt(questions)

```

From [README.md](https://raw.githubusercontent.com/magmax/python-inquirer/master/README.md)

## FAQ

### Which Python TUI library should I use?

[Textual](#textual) suits full-screen terminal applications built from nested widgets and CSS layouts. [prompt_toolkit](#prompt-toolkit) suits interactive prompts with Emacs or Vi key bindings. [Questionary](#questionary) suits command-line tools that need a few user prompts.

### What is Rich in Python?

[Rich](#rich) renders rich text, tables, progress bars, syntax highlighting, and Markdown in the terminal.

### What is Textual?

[Textual](#textual) builds terminal interfaces from nested widgets arranged in vertical, horizontal, and grid layouts. Its message handlers can call asynchronous APIs.

### What is Questionary?

[Questionary](#questionary) builds command-line user prompts in Python.

## How this page was built

Data checked Nov 20, 2026.

Reproduce it with the Exa API:

```json
{
  "endpoint": "/search",
  "body": {
    "query": "Python TUI libraries Textual Urwid prompt_toolkit PyTermGUI terminal UI layouts mouse asyncio syntax highlighting screenshots",
    "numResults": 5
  }
}
```

Docs: https://exa.ai/docs/reference/search
