Let’s say I have set up two files.
One is main.py:
from .terminal import current_instance
current_instance.addstr("Hello world!")
current_instance.refresh()
Other is terminal.py:
import curses
current_instance = curses.initscr()
curses.noecho()
curses.cbreak()
When I run main.py, the window is initiated, text printed, but after that the window closes and quits the program. If I try to put a loop in terminal.py, it’ll just block the program, and putting a loop in main.py would be inconvenient as I have other files that should also output text to the terminal window.
So is it possible to make the window “persistent”, while being non-blocking?
I tried calling nodelay() and making an asynchronous function that calls getch() infinitely, and while the window is persistent, the function is still blocking.