diff options
author | Eric S. Raymond <esr@thyrsus.com> | 2000-08-09 21:11:07 +0000 |
---|---|---|
committer | Eric S. Raymond <esr@thyrsus.com> | 2000-08-09 21:11:07 +0000 |
commit | ce85cfa8102c99ee5edec50de3d8f7d34c839834 (patch) | |
tree | be1f22700b963c3d1ef417335f633b82af10e67e /Lib/curses | |
parent | b1c07b345742bc44bdc795a08edd7156f56c6cf1 (diff) | |
download | cpython-ce85cfa8102c99ee5edec50de3d8f7d34c839834.tar.gz |
Tweak curses.wrapper so it initializes colors if they are available.
Diffstat (limited to 'Lib/curses')
-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 e7e7bb6af8..51fb7240dc 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 |