我一直试图在Python2.7中创建自己的基于文本的UI,但是我想到了一个关于输入的想法。所以我就这样想:input = raw_input("|" + "input: ".center(78) + "|"),但粗略地说,光标离右边很远(只是在我输入:P之前意识到它不起作用)。所以,问题是,我如何把一个输入放在屏幕中间,文本放在同一行上(两边),并在我写下“in put:”后使用光标类型?如果你想知道,我用这个:if True:
print c + "Hi! This is a text-based GUI!".center(78, h) + c
print c + "-" * 78 + c
print v + "OPTIONS".center(78) + v
print c + "-" * 78 + c
print v + "1 - Quit".center(78) + v
for i in range(1, 7):
print v + " " * 78 + v
print c + "-" * 78 + c
在翻译中,它看起来不错:+------------------------Hi! This is a text-based GUI!-------------------------+
+------------------------------------------------------------------------------+
| OPTIONS |
+------------------------------------------------------------------------------+
| 1 - Quit |
| |
| |
| |
| |
| |
| |
+------------------------------------------------------------------------------+
注意:我使用的是Windows XP