#๐ How do I select between 2 options in the terminal?
46 messages ยท Page 1 of 1 (latest)
@torpid crystal
Remember to:
- Ask your Python question, not if you can ask or if there's an expert who can help.
- Show a code sample as text (rather than a screenshot) and the error message, if you've got one.
- Explain what you expect to happen and what actually happens.
:warning: Do not pip install anything that isn't related to your question, especially if asked to over DMs.
did you end up installing a TUI library?
I tried but it seems like all the good ones arent working :(
do you need this solution or can you just have the user type 1 or 2?
It's not 100% nessecary but I really want to be able to show options this way
prompt_toolkit can probably do it. specifically prompt_toolkit.shortcuts.radiolist_dialog I think
Instead of having seperate lines each time you change which option you are hovering over, it'll just change where the X is
up to you if learning a TUI library just for this one feature is worth it
Yeah for some reason pip aint working for me ๐ญ
So your problem is with pip
When you say something is "not working" we don't know what you mean so you need to be specific.
People probably assumed you just didn't want to work with the TUI packages after you tried them, not that you couldn't install them.
I've got it to work now, sorry for not saying
turns out I was just being stupid
sorryt
It happens to everybody. Don't beat yourself up.
does windows-curses on python 3.12?
oof good question
IDK
some packages don't work with 3.12 because they aren't updated
I'm trying to use it but it doesn't seem to be working
!pip windows-curses
goddamnit this is why I should use linux
Ah that's recent. When you say not working what do you mean?
So I've installed it fine
and I'm trying to do this
import curses
from curses import wrapper
def main(stdscr):
stdscr.clear()
stdscr.refresh()
stdscr.getch()
wrapper(main)
From the tutorial I'm watching, it should make the screen go blank
and wait for the user to give a keyboard input
before ending
but when I try it, the terminal just freezes for a few seconds and then ends it
damn
I don't use Pylance so I don't know what that error means. Can you run that file from your terminal?
What do you mean?
it just means "why are you importing this if you aren't using it?".
but I am using it though?
No, you're using wrapper
Right, it's complaining about import curses
alright, even when I do this it's the exact same thing, so I'm not sure what's up
Did you save the file?
yup
you may try pyTermTk, it is self contained, include checkboxes or radiobuttons and is compatible with windows.
This is just straight up magic ๐คฉ
This help channel has been closed and it's no longer possible to send messages here. If your question wasn't answered, feel free to create a new post in #1035199133436354600. To maximize your chances of getting a response, check out this guide on asking good questions.