summaryrefslogtreecommitdiffstats
path: root/Lib/curses
diff options
context:
space:
mode:
authorEric S. Raymond <esr@thyrsus.com>2000-08-09 21:11:07 (GMT)
committerEric S. Raymond <esr@thyrsus.com>2000-08-09 21:11:07 (GMT)
commit1ebd3f6c4bf8c20750064b06a82e8727ce50e72b (patch)
tree23e40c7a513d693a6f8be040cf299973ed63c6cc /Lib/curses
parent46a415167464d8a7234c4a79dc4f7df084211825 (diff)
downloadcpython-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')
-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 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