我正在用python在终端中创建一个登录面板,我希望在输入之前动态更改图标,即每当用户填充输入时,图标都会更改
例如:
F:\command_line>python main.py
? username: # initially there is a question mark.
✓ username: # If the user fills the username the icon changes to ✓
我试过:
default = '?'
onChange = '✓'
inp = input(default + " " + name + ":")
# I can't figure out how I can change it
有可能这样做吗?如果是的话,我怎样才能做到呢
我不会告诉你整件事,但是@PranavHosangadi提供的链接是一个很好的资源
似乎您正在使用Windows,因此
curses
模块无法立即使用。但是,您可以pip install windows-curses
获得大部分功能。虽然我注意到一些常量,如curses.KEY_BACKSPACE
,在windows版本上有所不同,但您可以对其进行修改,并确定哪些适用于您一些资源:
Official Docs
Some helpful examples 这一部分只有linux的部分,但是经过一些尝试和错误,这些部分是显而易见的
相关问题 更多 >
编程相关推荐