In below code box.gather() removes empty lines from text. Is there a way to collect the text as is including empty lines?
from curses import wrapper
from curses.textpad import Textbox
def main(stdscr):
stdscr.addstr(0, 0, "Enter text separated by empty lines: (hit Ctrl-G to send)")
box = Textbox(stdscr)
box.edit()
return box.gather()
if __name__ == '__main__':
s = wrapper(main)
print(s)
Textboxobject containstripspacesattribute which handles this behaviour.From documentation:
stripspaces
So, your final code will look like this: