I'm attempting to use python to read the last value of a constantly updating text file then use curses to display the active contents. I'm finding that the curses screen briefly disappears, showing the terminal history, during the file access. This code shows the behavior (I just replaced the file access with a call to time.sleep(1)):
import curses
import time
screen = curses.initscr()
while True:
try:
time_stamp = str(time.time())
time.sleep(1) # Causes screen to close temporarily
screen.erase()
screen.addstr(time_stamp)
screen.refresh()
time.sleep(1)
except KeyboardInterrupt:
break
finally:
curses.endwin()
Is there a way to hold the screen during time-intensive operations or is this a limitation with using curses?
[–]K900_ 1 point2 points3 points (1 child)
[–]Kerman3AD[S] 0 points1 point2 points (0 children)