If you’re tired of writing boring input()
prompts and want to build interactive command-line menus that don’t feel like they’re from 1995, you’re in the right place.
Let’s be real—nobody wants to navigate through a 50-option menu by typing “Enter option 32” manually. Fortunately, Python has some amazing libraries that can handle interactive CLI menus without making you cry.
1. Prompt Toolkit (For Pros Who Like Fancy CLIs)
🛠 Best For: Developers who need powerful and flexible CLI interactions.
🖥 Works On: Windows, Linux, Mac
⚡ Key Features: Auto-completion, syntax highlighting, multi-line editing.
This library is the swiss army knife of interactive CLIs. It’s not just for menus—you can build full-on command-line applications.
Example:
|
|
If you need autocomplete, syntax highlighting, and fancy text editing, Prompt Toolkit is your go-to. But if you’re just making a simple menu, it might be overkill.
2. PyInquirer (Inspired by Inquirer.js)
🛠 Best For: Developers who love pretty, structured CLI prompts.
🖥 Works On: Windows, Linux, Mac
⚡ Key Features: Lists, checkboxes, password input, validation.
Think of PyInquirer as the stylish, modern cousin of the old-school input()
function. Inspired by Inquirer.js, it makes CLI menus look clean and interactive.
Example:
|
|
Unfortunately, PyInquirer hasn’t been updated in a while, but it still works fine. If you like it but want something maintained, check out questionary
.
3. questionary (The Maintained PyInquirer Alternative)
🛠 Best For: Developers who need interactive prompts without outdated libraries.
🖥 Works On: Windows, Linux, Mac
⚡ Key Features: Multi-select, confirmation prompts, auto-complete.
This is basically PyInquirer but actively maintained. It offers all the same features, but you don’t have to worry about abandonware.
Example:
|
|
4. curses (For the Hardcore Terminal Nerds)
🛠 Best For: Developers who love old-school text-based UI applications.
🖥 Works On: Linux & Mac (Windows needs third-party libraries)
⚡ Key Features: Low-level terminal control, full-screen UI capabilities.
If you’re into retro terminal UI programming, curses
is your best friend. But beware—this isn’t a simple menu library. It’s a full-on terminal UI toolkit.
Example:
|
|
⚠ Heads up: Windows doesn’t support curses
natively. You’ll need windows-curses.
5. Click (For Building Full CLI Applications)
🛠 Best For: Developers building structured CLI tools with argument parsing.
🖥 Works On: Windows, Linux, Mac
⚡ Key Features: Command-line argument parsing, interactive prompts.
If your goal is not just a menu but a full-blown CLI application, Click
is your best bet.
Example:
|
|
Click is great for building serious CLI apps, but if you just need a simple interactive menu, it’s overkill.
🌈 Adding Colors and Styling
Want to add color to your CLI? Click has built-in support for ANSI colors.
|
|
6. Rich (For Fancy-Looking Menus)
🛠 Best For: Developers who want beautiful CLI menus with colors & formatting.
🖥 Works On: Windows, Linux, Mac
⚡ Key Features: Styled text, tables, markdown rendering.
If you want your CLI menu to look amazing, Rich
is the way to go.
Example:
|
|
It doesn’t have built-in menus, but if you combine it with questionary
, you get beautiful + interactive.
Comparison Table
Library | Best For | Works on Windows? | Works on Linux? | Complexity |
---|---|---|---|---|
Prompt Toolkit | Full-fledged CLI applications | ✅ Yes | ✅ Yes | High |
PyInquirer | Simple interactive menus | ✅ Yes | ✅ Yes | Medium |
questionary | Maintained alternative to PyInquirer | ✅ Yes | ✅ Yes | Medium |
curses | Terminal UI apps | ❌ No* | ✅ Yes | High |
Click | Full CLI applications | ✅ Yes | ✅ Yes | Medium |
Rich | Pretty-looking CLI menus | ✅ Yes | ✅ Yes | Low |
curses
requires windows-curses on Windows.
Final Thoughts
- Need powerful CLI tools? →
Prompt Toolkit
- Want simple interactive menus? →
questionary
- Building a full CLI app? →
Click
- Want your menus to look fancy? →
Rich
Use the right tool for the job, and your command-line menus will go from boring to awesome.