Hacker News new | past | comments | ask | show | jobs | submit login
Show HN: Beautiful Python List Prompts Package (github.com)
189 points by Mckinsey666 55 days ago | hide | past | web | favorite | 31 comments

FYI, not exactly the same, but Dialog is an excellent tool for creating ncurses based GUIs for shell scripts...


Gee, this is legit. Gave me some insights. Thanks a lot :)!

if you want to use python together with dialog to build cli menus, i recommend using http://pythondialog.sourceforge.net/doc/. i've been using it for a project at work and it's very nice!

seems like this isn't maintained?

This is really nice. I'm working on a similar project right now, trying to hook together a few console UI pieces like this into a coherent annotation tool:


It's not as pretty as bullet, but it's trying to fit in an annotation loop. It would be super cool to extend bullet to choose-many questions too.

Thanks for the feedback! Will definitely add more features to this package. Wrapping up several prompts together is a great idea too, thanks for the insight.

First thoughts were that this was handled by Prompt Toolkit, but it's actually a slightly different case to the auto complete which that one offers:


Might be useful to handle deactivated choices (ie greyed out).

It looks like it handles multi choice (with the check feature), but can it do validation upon a check being selected or does it need to wait until the user has made their choice? Am thinking for catching invalid combinations.

Hey HN I've added some new features including a prompt wrapper object to wrap the UI components together. Please check it out:


btw thanks to lars512 for the advice.

Looks cool. I'd like to see more widgets though, like a checkbox or simple form widget.

One package just for a radio list is too much like the npm way of doing things.

Thanks for the feedback. I will add more features to this package asap.

I want this from Python Click. I remember I asked him on Twitter long back don't know it's ported to Click.



Well there is Gooey, FWIW: https://pypi.org/project/Gooey/

do you know of an other package that does this? just yesterday and this morning I was looking for something like this but I could've sworn there's a more modern package. I just can't seem to find the right Google keywords to land on it.

edit: and in particular for click. i didn't realize gooey was for arg parse

There is similar project https://github.com/Kamik423/cutie for someone who is interested in cli dialogs.

I've previously built a similar package, much simpler: https://github.com/wong2/pick

I like this a lot. Will definitely try it out at some point.

termios issue. I installed this via pip in python 3.7 under windows 10 and got an error about the termios package not being available. But trying to install termios via pip reports that the package is not available. Any suggestions?

The readme only claims to support Linux.

termios is a built-in package, but not for Windows. https://docs.python.org/3/library/termios.html

This is awesome, I've been using Pick, but this looks a lot nicer!

If there's one trend I can't stand it's developers claiming that their own projects are "beautiful".

Ah, natural languages and their lack of grouping operators.

It's (Beautiful Python List Prompts) Package, not Beautiful (Python List Prompts Package).

Oh, so the former is not actually making any claims about being beautiful? Please...

Just tell me what it does. I'll decide if it's beautiful.

i'd say "beautiful" in this context is shorthand for "built with attention towards aesthetics", which is often not the case for programmer tools like this

What are the use cases? This looks like a fun project without any real applications. A react component makes sense because it hooks into an existing ecosystem but how would something like this get used in an existing cli?

Edit: React has an ecosystem for things like this. Cocoa/Obj-C has an ecosystem for things like this. Tiny single purpose UI elements. Python does not have this because there is no UI framework for doing console applications that doesn’t already provide this capability as part of a batteries included tool.

I don't quite follow you here. It is a library for making some simple UI for command line applications.

If you have a command line application in python you could implement this for fancier list selections.

I'm unclear on how you relate this to React components. Python libraries have been part of an existing ecosystem long before React. The python ecosystem.

I can think of a lot of simple scripts that I could easily plug this into. When I’m writing a little script to do something for me, the last thing I want to do is write any sort of UI

Oh god the amount of scripts I have that do something like:

  while True:
    for i, item in enumerate(list):
      print(i, item, sep=" - ")

    choice = input()

    if valid(choice):
This would make those so much easier to write and give a much nicer UI at the same time.

Can’t tell if you’re being sarcastic or not. Your above sample code is perfectly simple and straightforward. I would choose it over an over engineered ui library/dependency in a heartbeat.

It’s just a command line library for spliffying up command line interfaces.

Where does React come into this? That’s for the web...

Guidelines | FAQ | Support | API | Security | Lists | Bookmarklet | Legal | Apply to YC | Contact