在windows上有蟒蛇,我一直在做游戏。但是,这个游戏需要msvcrt模块,它只能在windows上使用。我需要函数msvcrt.getch()。如果我能在Ubuntu或任何linux计算机上运行这个游戏,那么我可以使用哪个模块呢?我不会介意它不能在linux上工作,但我真的很想找到一种方法。同样,在ubuntu上是否有使用msvcrt.getch函数的模块或工具?
发布于 2019-12-13 17:44:39
库msvcrs仅在Windows上可用。如果要为Ubuntu使用发行版,请检查getch函数。
import getch此函数可在键盘上按下键.
希望能帮上忙!
发布于 2022-11-26 14:34:28
在命令行中,如有必要(如Luan Souza上文所述):
pip install getch在您的代码中:
try:
from getch import getch, getche # Linux
except ImportError:
from msvcrt import getch, getche # Windowshttps://stackoverflow.com/questions/38172907
复制相似问题