Question: copy/deepcopy with the curses module?
Damond Walker
dwalker at iximd.com
Sun Aug 15 12:51:08 EDT 1999
I'm writing a small program which uses the standard curses module.
While the program runs I show message boxes, sometimes two levels deep. At
this point I have a nice layered display. Good so far. :)
Now, the user interacts with the topmost message box so that it
dissapears. To repaint the screen I'm clearing it and repainting everything
from scratch. The end result is what I want but the performance is, shall
we say, somewhat pitiful. On a fast machine the user probably wouldn't
notice but on a slower machine the user can actually track the progress of
the paint process.
The code is layered like this...
class SIO: <contains methods which interact with curses>
self.stdscr = curses.init...()
self.s = newwin(...)
class MsgBox(DialogContainer):
def __init__(self, Screen, Message):
self.SetProperty("SCREEN", Screen) # Screen points to instance
of SIO
All my classes use the same instance of SIO (which basically provides a
wrapper around displaying text on the console).
What I want to do is get a snapshot of the current SIO instance. This
would allow me to quickly save the current SIO instance in a temp. variable,
do some screen updates, and then quickly repaint the screen by restoring the
SIO instance to it's older value.
I tried to use the Copy module (copy and deepcopy) but it complained
about how it couldn't copy the curses stuff.
Anyone have any pointers? (note: I'd like to do this using the standard
modules which are distributed with Python 1.5.2)
Damond
More information about the Python-list
mailing list