Updated for 2.1a3
[python/dscho.git] / Lib / curses / __init__.py
blob6bcd56602c71f08cad5a28b94dcfdc07f7a07872
1 """curses
3 The main package for curses support for Python. Normally used by importing
4 the package, and perhaps a particular module inside it.
6 import curses
7 from curses import textpad
8 curses.initwin()
9 ...
11 """
13 __revision__ = "$Id$"
15 from _curses import *
16 from curses.wrapper import wrapper
18 # Some constants, most notably the ACS_* ones, are only added to the C
19 # _curses module's dictionary after initscr() is called. (Some
20 # versions of SGI's curses don't define values for those constants
21 # until initscr() has been called.) This wrapper function calls the
22 # underlying C initscr(), and then copies the constants from the
23 # _curses module to the curses package's dictionary. Don't do 'from
24 # curses import *' if you'll be needing the ACS_* constants.
26 def initscr():
27 import _curses, curses
28 stdscr = _curses.initscr()
29 for key, value in _curses.__dict__.items():
30 if key[0:4] == 'ACS_' or key in ('LINES', 'COLS'):
31 setattr(curses, key, value)
33 return stdscr
35 # Import Python has_key() implementation if _curses doesn't contain has_key()
37 try:
38 has_key
39 except NameError:
40 from has_key import has_key