summaryrefslogtreecommitdiff
path: root/Lib/curses
diff options
context:
space:
mode:
authorEric S. Raymond <esr@thyrsus.com>2000-08-09 21:11:07 +0000
committerEric S. Raymond <esr@thyrsus.com>2000-08-09 21:11:07 +0000
commitce85cfa8102c99ee5edec50de3d8f7d34c839834 (patch)
treebe1f22700b963c3d1ef417335f633b82af10e67e /Lib/curses
parentb1c07b345742bc44bdc795a08edd7156f56c6cf1 (diff)
downloadcpython-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.py9
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