<br>
Hello all,<br>
<br>
Im writing about a topic which was discussed previously on this mailing list but didn't seem to be answered..<br>
<br>
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)<br>
<br>
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.<br>
<br>
<pre>#!/usr/bin/python<br>import sys, curses<br><br>def sub(scrn):<br> s = curses.newwin(4, 30, 1, 1)<br> s.erase()<br> s.box()<br> s.addstr(1, 1, "sub window")<br> s.refresh()<br> s.getch()<br>
# curses.delwin(s) <-- that doesn't exist :-/<br> scrn.refresh()<br><br>def main(scrn):<br> scrn = curses.initscr()<br> curses.curs_set(0) # turn cursor off<br> scrn.erase()<br> scrn.addstr
(2, 2, "press <F1> to continue, <F12> to quit");<br> while 1:<br> c = scrn.getch()<br> if c == curses.KEY_F12: sys.exit()<br> elif c == curses.KEY_F1: sub(scrn)<br><br># main loop
<br>if __name__ == '__main__':<br> curses.wrapper(main)<br> sys.exit()</pre>
<br>
<br>
<br>