#๐Ÿ”’ How do I select between 2 options in the terminal?

46 messages ยท Page 1 of 1 (latest)

timid stoneBOT
#

@torpid crystal

Python help channel opened

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.

hardy salmon
#

did you end up installing a TUI library?

torpid crystal
hardy salmon
#

do you need this solution or can you just have the user type 1 or 2?

torpid crystal
left horizon
#

prompt_toolkit can probably do it. specifically prompt_toolkit.shortcuts.radiolist_dialog I think

torpid crystal
#

Instead of having seperate lines each time you change which option you are hovering over, it'll just change where the X is

hardy salmon
#

up to you if learning a TUI library just for this one feature is worth it

torpid crystal
#

Yeah for some reason pip aint working for me ๐Ÿ˜ญ

crude flame
#

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.

torpid crystal
#

I've got it to work now, sorry for not saying

#

turns out I was just being stupid

#

sorryt

crude flame
#

It happens to everybody. Don't beat yourself up.

torpid crystal
#

does windows-curses on python 3.12?

crude flame
#

oof good question

#

IDK

#

some packages don't work with 3.12 because they aren't updated

torpid crystal
#

I'm trying to use it but it doesn't seem to be working

crude flame
#

!pip windows-curses

timid stoneBOT
torpid crystal
#

goddamnit this is why I should use linux

crude flame
#

Ah that's recent. When you say not working what do you mean?

torpid crystal
#

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

crude flame
#

I don't use Pylance so I don't know what that error means. Can you run that file from your terminal?

torpid crystal
#

What do you mean?

left horizon
#

it just means "why are you importing this if you aren't using it?".

torpid crystal
#

but I am using it though?

crude flame
#

No, you're using wrapper

torpid crystal
crude flame
#

Right, it's complaining about import curses

torpid crystal
#

alright, even when I do this it's the exact same thing, so I'm not sure what's up

crude flame
#

Did you save the file?

torpid crystal
#

yup

high surge
torpid crystal
#

This is just straight up magic ๐Ÿคฉ

timid stoneBOT
#
Python help channel closed

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.