'not able to append in a list in curses module?
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)
Solution 1:[1]
You call wrapper(main) after you print the (empty) list. Change the order of the statements.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | DYZ |
