diff options
| author | Eric S. Raymond <esr@thyrsus.com> | 2000-08-09 21:11:07 (GMT) | 
|---|---|---|
| committer | Eric S. Raymond <esr@thyrsus.com> | 2000-08-09 21:11:07 (GMT) | 
| commit | 1ebd3f6c4bf8c20750064b06a82e8727ce50e72b (patch) | |
| tree | 23e40c7a513d693a6f8be040cf299973ed63c6cc /Lib/curses/wrapper.py | |
| parent | 46a415167464d8a7234c4a79dc4f7df084211825 (diff) | |
| download | cpython-1ebd3f6c4bf8c20750064b06a82e8727ce50e72b.zip cpython-1ebd3f6c4bf8c20750064b06a82e8727ce50e72b.tar.gz cpython-1ebd3f6c4bf8c20750064b06a82e8727ce50e72b.tar.bz2  | |
Tweak curses.wrapper so it initializes colors if they are available.
Diffstat (limited to 'Lib/curses/wrapper.py')
| -rw-r--r-- | Lib/curses/wrapper.py | 9 | 
1 files changed, 9 insertions, 0 deletions
diff --git a/Lib/curses/wrapper.py b/Lib/curses/wrapper.py index e7e7bb6..51fb724 100644 --- a/Lib/curses/wrapper.py +++ b/Lib/curses/wrapper.py @@ -32,6 +32,15 @@ def wrapper(func, *rest):  	# a special value like curses.KEY_LEFT will be returned          stdscr.keypad(1) +        # Start color, too.  Harmless if the terminal doesn't have +        # color; user can test with has_color() later on.  The try/catch +        # works around a minor bit of over-conscientiousness in the curses +        # module -- the error return from C start_color() is ignorable. +        try: +            curses.start_color() +        except: +            pass +          res = apply(func, (stdscr,) + rest)      except:  	# In the event of an error, restore the terminal  | 
