Home:ALL Converter>addstr delay in Python Curses

addstr delay in Python Curses

Ask Time:2015-06-10T19:15:56         Author:Sean Downey

Json Formatter

I'm working on an AI and I am using Curses and I would like to be able to add a message, wait five seconds then draw another message.

Below is the piece I am trying to fix

#!/usr/bin/env python
# -*- coding: utf-8 -*-

import curses
import time

screen = curses.initscr()
curses.noecho()
curses.curs_set(0)
screen.keypad(1)

screen.addstr("This is a Sample Curses Script\n\n")
screen.addstr("This is a Sample Curses Script\n\n")
time.sleep(5)
screen.addstr("This is a Sample Curses Script\n\n")
while True:
   event = screen.getch()
   if event == ord("q"): break

curses.endwin()

Author:Sean Downey,eproduced under the CC 4.0 BY-SA copyright license with a link to the original source and this disclaimer.
Link to original article:https://stackoverflow.com/questions/30754683/addstr-delay-in-python-curses
yy