无法在诅咒模块中的列表中附加吗?
我想用Python诅咒模块进行用户输入,但是每次不添加列表中的任何元素时,请帮助我
import curses
from curses import wrapper
from curses.textpad import Textbox, rectangle
tempo_list = []
def main(stdscr, text="hello"):
final_text = text + " (hit Ctrl-G to send)"
for i in range(5):
stdscr.addstr(0, 0, final_text)
win = curses.newwin(1, 21, 2, 1)
box = Textbox(win)
rectangle(stdscr, 1, 0, 3, 23)
stdscr.refresh()
box.edit()
val = box.gather().replace("\n", "")
tempo_list.append(val)
print(tempo_list)
wrapper(main)
I want to take a user input with python curses module but every time it is not adding any element in the list can any one please help me
my code :-
import curses
from curses import wrapper
from curses.textpad import Textbox, rectangle
tempo_list = []
def main(stdscr, text="hello"):
final_text = text + " (hit Ctrl-G to send)"
for i in range(5):
stdscr.addstr(0, 0, final_text)
win = curses.newwin(1, 21, 2, 1)
box = Textbox(win)
rectangle(stdscr, 1, 0, 3, 23)
stdscr.refresh()
box.edit()
val = box.gather().replace("\n", "")
tempo_list.append(val)
print(tempo_list)
wrapper(main)
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您调用
wrapper(main)
您打印(空)列表。更改语句的顺序。You call
wrapper(main)
after you print the (empty) list. Change the order of the statements.