Hello all,
Im writing about a topic which was discussed previously on this mailing list but didn't seem to be answered..
Bernd Prager asked whether the curses modules in Python had functionality like that of delwin() in the C libraries. He also supplied the below code sample to demonstrate the problem. (Thanks Bernd)
Where he has commented # curses.delwin(s) would be where in C one could close the sub window created in sub() and refresh the underlying scrn. Ive also been unable to find how this is done and any assistance would be appreciated.
#!/usr/bin/python
import sys, curses
def sub(scrn):
s = curses.newwin(4, 30, 1, 1)
s.erase()
s.box()
s.addstr(1, 1, "sub window")
s.refresh()
s.getch()
# curses.delwin(s) <-- that doesn't exist :-/
scrn.refresh()
def main(scrn):
scrn = curses.initscr()
curses.curs_set(0) # turn cursor off
scrn.erase()
scrn.addstr (2, 2, "press <F1> to continue, <F12> to quit");
while 1:
c = scrn.getch()
if c == curses.KEY_F12: sys.exit()
elif c == curses.KEY_F1: sub(scrn)
# main loop
if __name__ == '__main__':
curses.wrapper(main)
sys.exit()
_______________________________________________ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor