3
\&
ã @ sb d Z ddlT ddlZddlZdd„ Zdd„ Zye W n e k
rT dd lmZ Y nX d
d„ Z
dS )zØcurses
The main package for curses support for Python. Normally used by importing
the package, and perhaps a particular module inside it.
import curses
from curses import textpad
curses.initscr()
...
é )Ú*Nc C st dd l } dd l}ttjjddƒtjjƒ d� | j ƒ }x:| j
jƒ D ],\}}|dd… dks`|d kr@t|||ƒ q@W |S )
Nr ZTERMÚunknown)ZtermÚfdé ZACS_ÚLINESÚCOLS)r r )
Ú_cursesÚcursesZ setuptermÚ_osÚenvironÚgetÚ_sysÚ
__stdout__ÚfilenoÚinitscrÚ__dict__ÚitemsÚsetattr)r r ÚstdscrÚkeyÚvalue© r ú'/usr/lib64/python3.6/curses/__init__.pyr s r c C s@ dd l } dd l}| jƒ }t| dƒr*| j|_t| dƒr<| j|_|S )Nr ÚCOLORSÚCOLOR_PAIRS)r r Ústart_colorÚhasattrr r )r r Zretvalr r r r * s
r é )Úhas_keyc O sr zDt ƒ }tƒ tƒ |jdƒ y
tƒ W n Y nX | |f|ž|ŽS dtƒ krl|jdƒ tƒ tƒ tƒ X dS )a Wrapper function that initializes curses and calls another function,
restoring normal keyboard/screen behavior on error.
The callable object 'func' is then passed the main window 'stdscr'
as its first argument, followed by any other arguments passed to
wrapper().
r Nr r ) r ZnoechoZcbreakZkeypadr ÚlocalsZechoZnocbreakZendwin)ÚfuncÚargsÚkwdsr r r r Úwrapper? s
r# )Ú__doc__r Úosr
Úsysr
r r r Ú NameErrorr# r r r r Ú