[Tutor] curses delwin functionality?

Jonathan Bohren jbohren at seas.upenn.edu
Sun Jun 15 20:32:01 CEST 2008

 > I'm trying to get my hands on some curses experiences in Python.
 > The examples I found don't really tell me how to get rid of  
subwindows and
 > restore the underlying window again. Is there something that  
replaces the
 > curses functionality "delwin"?
 > Thanks for any help!

I had the same question, and I performed some simple experiments.

1) Re-assignment. I ran this and watched python's memory usage. It was  
completely flat.
for i in range(1,50000):
     win = curses.newwin(10,1,0,2*2*i)
     win.bkgd(' ',curses.A_REVERSE)

It seems that python calls the underlying curses API  
delwin(some_window) when some_window goes out of scope. Thus, there is  
no need to call something like it explicitly.
Hope this helps.

More information about the Tutor mailing list