Skip to content

Getting Started

Install

The first step is to install Inquirer-Textual.

Inside a virtual environemnt, this library can be installed with:

pip install inquirer-textual

Simple text prompt

The prompt API is very straightforward, for example to get a text input:

from inquirer_textual import prompts

if __name__ == "__main__":
    name = prompts.text('Enter your name:')
    print(f'Hello, {name}! 👋')

Simple text prompt

Multiple prompts

By calling the prompt API multiple times, a form-like inquiry can be done:

from inquirer_textual import prompts

if __name__ == "__main__":
    first_name = prompts.text('First name:')
    last_name = prompts.text('Last name:')
    print(f'Hello, {first_name} {last_name}! 👋')

Simple text prompts

It's also possible to use a single multi prompt:

from inquirer_textual import prompts
from inquirer_textual.widgets.InquirerText import InquirerText

if __name__ == "__main__":
    answers = first_name = prompts.multi([
        ('first_name', InquirerText('First name:')),
        ('last_name', InquirerText('Last name:'))
    ])
    print(f'Hello, {answers["first_name"]} {answers["last_name"]}! 👋')

Simple multi prompt