~dkuhlman/python-training-materials/Materials

« back to all changes in this revision

Viewing changes to python-2.7.12-docs-html/library/curses.html

  • Committer: Dave Kuhlman
  • Date: 2017-04-15 16:24:56 UTC
  • Revision ID: dkuhlman@davekuhlman.org-20170415162456-iav9vozzg4iwqwv3
Updated docs

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
 
2
  "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
 
3
 
 
4
 
 
5
<html xmlns="http://www.w3.org/1999/xhtml">
 
6
  <head>
 
7
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
 
8
    
 
9
    <title>15.11. curses — Terminal handling for character-cell displays &mdash; Python 2.7.12 documentation</title>
 
10
    
 
11
    <link rel="stylesheet" href="../_static/classic.css" type="text/css" />
 
12
    <link rel="stylesheet" href="../_static/pygments.css" type="text/css" />
 
13
    
 
14
    <script type="text/javascript">
 
15
      var DOCUMENTATION_OPTIONS = {
 
16
        URL_ROOT:    '../',
 
17
        VERSION:     '2.7.12',
 
18
        COLLAPSE_INDEX: false,
 
19
        FILE_SUFFIX: '.html',
 
20
        HAS_SOURCE:  true
 
21
      };
 
22
    </script>
 
23
    <script type="text/javascript" src="../_static/jquery.js"></script>
 
24
    <script type="text/javascript" src="../_static/underscore.js"></script>
 
25
    <script type="text/javascript" src="../_static/doctools.js"></script>
 
26
    <script type="text/javascript" src="../_static/sidebar.js"></script>
 
27
    <link rel="search" type="application/opensearchdescription+xml"
 
28
          title="Search within Python 2.7.12 documentation"
 
29
          href="../_static/opensearch.xml"/>
 
30
    <link rel="author" title="About these documents" href="../about.html" />
 
31
    <link rel="copyright" title="Copyright" href="../copyright.html" />
 
32
    <link rel="top" title="Python 2.7.12 documentation" href="../contents.html" />
 
33
    <link rel="up" title="15. Generic Operating System Services" href="allos.html" />
 
34
    <link rel="next" title="15.13. curses.ascii — Utilities for ASCII characters" href="curses.ascii.html" />
 
35
    <link rel="prev" title="15.10. getpass — Portable password input" href="getpass.html" />
 
36
    <link rel="shortcut icon" type="image/png" href="../_static/py.png" />
 
37
    <script type="text/javascript" src="../_static/copybutton.js"></script>
 
38
    <script type="text/javascript" src="../_static/version_switch.js"></script>
 
39
 
 
40
    
 
41
 
 
42
  </head>
 
43
  <body role="document">  
 
44
    <div class="related" role="navigation" aria-label="related navigation">
 
45
      <h3>Navigation</h3>
 
46
      <ul>
 
47
        <li class="right" style="margin-right: 10px">
 
48
          <a href="../genindex.html" title="General Index"
 
49
             accesskey="I">index</a></li>
 
50
        <li class="right" >
 
51
          <a href="../py-modindex.html" title="Python Module Index"
 
52
             >modules</a> |</li>
 
53
        <li class="right" >
 
54
          <a href="curses.ascii.html" title="15.13. curses.ascii — Utilities for ASCII characters"
 
55
             accesskey="N">next</a> |</li>
 
56
        <li class="right" >
 
57
          <a href="getpass.html" title="15.10. getpass — Portable password input"
 
58
             accesskey="P">previous</a> |</li>
 
59
        <li><img src="../_static/py.png" alt=""
 
60
                 style="vertical-align: middle; margin-top: -1px"/></li>
 
61
        <li><a href="https://www.python.org/">Python</a> &raquo;</li>
 
62
        <li>
 
63
          <span class="version_switcher_placeholder">2.7.12</span>
 
64
          <a href="../index.html">Documentation</a> &raquo;
 
65
        </li>
 
66
 
 
67
          <li class="nav-item nav-item-1"><a href="index.html" >The Python Standard Library</a> &raquo;</li>
 
68
          <li class="nav-item nav-item-2"><a href="allos.html" accesskey="U">15. Generic Operating System Services</a> &raquo;</li> 
 
69
      </ul>
 
70
    </div>    
 
71
 
 
72
    <div class="document">
 
73
      <div class="documentwrapper">
 
74
        <div class="bodywrapper">
 
75
          <div class="body" role="main">
 
76
            
 
77
  <div class="section" id="module-curses">
 
78
<span id="curses-terminal-handling-for-character-cell-displays"></span><h1>15.11. <a class="reference internal" href="#module-curses" title="curses: An interface to the curses library, providing portable terminal handling. (Unix)"><code class="xref py py-mod docutils literal"><span class="pre">curses</span></code></a> &#8212; Terminal handling for character-cell displays<a class="headerlink" href="#module-curses" title="Permalink to this headline">¶</a></h1>
 
79
<div class="versionchanged">
 
80
<p><span class="versionmodified">Changed in version 1.6: </span>Added support for the <code class="docutils literal"><span class="pre">ncurses</span></code> library and converted to a package.</p>
 
81
</div>
 
82
<p>The <a class="reference internal" href="#module-curses" title="curses: An interface to the curses library, providing portable terminal handling. (Unix)"><code class="xref py py-mod docutils literal"><span class="pre">curses</span></code></a> module provides an interface to the curses library, the
 
83
de-facto standard for portable advanced terminal handling.</p>
 
84
<p>While curses is most widely used in the Unix environment, versions are available
 
85
for DOS, OS/2, and possibly other systems as well.  This extension module is
 
86
designed to match the API of ncurses, an open-source curses library hosted on
 
87
Linux and the BSD variants of Unix.</p>
 
88
<div class="admonition note">
 
89
<p class="first admonition-title">Note</p>
 
90
<p>Since version 5.4, the ncurses library decides how to interpret non-ASCII data
 
91
using the <code class="docutils literal"><span class="pre">nl_langinfo</span></code> function.  That means that you have to call
 
92
<a class="reference internal" href="locale.html#locale.setlocale" title="locale.setlocale"><code class="xref py py-func docutils literal"><span class="pre">locale.setlocale()</span></code></a> in the application and encode Unicode strings
 
93
using one of the system&#8217;s available encodings.  This example uses the
 
94
system&#8217;s default encoding:</p>
 
95
<div class="highlight-python"><div class="highlight"><pre><span></span><span class="kn">import</span> <span class="nn">locale</span>
 
96
<span class="n">locale</span><span class="o">.</span><span class="n">setlocale</span><span class="p">(</span><span class="n">locale</span><span class="o">.</span><span class="n">LC_ALL</span><span class="p">,</span> <span class="s1">&#39;&#39;</span><span class="p">)</span>
 
97
<span class="n">code</span> <span class="o">=</span> <span class="n">locale</span><span class="o">.</span><span class="n">getpreferredencoding</span><span class="p">()</span>
 
98
</pre></div>
 
99
</div>
 
100
<p class="last">Then use <em>code</em> as the encoding for <a class="reference internal" href="stdtypes.html#str.encode" title="str.encode"><code class="xref py py-meth docutils literal"><span class="pre">str.encode()</span></code></a> calls.</p>
 
101
</div>
 
102
<div class="admonition seealso">
 
103
<p class="first admonition-title">See also</p>
 
104
<dl class="docutils">
 
105
<dt>Module <a class="reference internal" href="curses.ascii.html#module-curses.ascii" title="curses.ascii: Constants and set-membership functions for ASCII characters."><code class="xref py py-mod docutils literal"><span class="pre">curses.ascii</span></code></a></dt>
 
106
<dd>Utilities for working with ASCII characters, regardless of your locale settings.</dd>
 
107
<dt>Module <a class="reference internal" href="curses.panel.html#module-curses.panel" title="curses.panel: A panel stack extension that adds depth to  curses windows."><code class="xref py py-mod docutils literal"><span class="pre">curses.panel</span></code></a></dt>
 
108
<dd>A panel stack extension that adds depth to  curses windows.</dd>
 
109
<dt>Module <a class="reference internal" href="#module-curses.textpad" title="curses.textpad: Emacs-like input editing in a curses window."><code class="xref py py-mod docutils literal"><span class="pre">curses.textpad</span></code></a></dt>
 
110
<dd>Editable text widget for curses supporting  <strong class="program">Emacs</strong>-like bindings.</dd>
 
111
<dt><a class="reference internal" href="../howto/curses.html#curses-howto"><span>Curses Programming with Python</span></a></dt>
 
112
<dd>Tutorial material on using curses with Python, by Andrew Kuchling and Eric
 
113
Raymond.</dd>
 
114
</dl>
 
115
<p class="last">The <a class="reference external" href="https://hg.python.org/cpython/file/2.7/Demo/curses/">Demo/curses/</a> directory in the Python source distribution contains
 
116
some example programs using the curses bindings provided by this module.</p>
 
117
</div>
 
118
<div class="section" id="functions">
 
119
<span id="curses-functions"></span><h2>15.11.1. Functions<a class="headerlink" href="#functions" title="Permalink to this headline">¶</a></h2>
 
120
<p>The module <a class="reference internal" href="#module-curses" title="curses: An interface to the curses library, providing portable terminal handling. (Unix)"><code class="xref py py-mod docutils literal"><span class="pre">curses</span></code></a> defines the following exception:</p>
 
121
<dl class="exception">
 
122
<dt id="curses.error">
 
123
<em class="property">exception </em><code class="descclassname">curses.</code><code class="descname">error</code><a class="headerlink" href="#curses.error" title="Permalink to this definition">¶</a></dt>
 
124
<dd><p>Exception raised when a curses library function returns an error.</p>
 
125
</dd></dl>
 
126
 
 
127
<div class="admonition note">
 
128
<p class="first admonition-title">Note</p>
 
129
<p class="last">Whenever <em>x</em> or <em>y</em> arguments to a function or a method are optional, they
 
130
default to the current cursor location. Whenever <em>attr</em> is optional, it defaults
 
131
to <code class="xref py py-const docutils literal"><span class="pre">A_NORMAL</span></code>.</p>
 
132
</div>
 
133
<p>The module <a class="reference internal" href="#module-curses" title="curses: An interface to the curses library, providing portable terminal handling. (Unix)"><code class="xref py py-mod docutils literal"><span class="pre">curses</span></code></a> defines the following functions:</p>
 
134
<dl class="function">
 
135
<dt id="curses.baudrate">
 
136
<code class="descclassname">curses.</code><code class="descname">baudrate</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#curses.baudrate" title="Permalink to this definition">¶</a></dt>
 
137
<dd><p>Return the output speed of the terminal in bits per second.  On software
 
138
terminal emulators it will have a fixed high value. Included for historical
 
139
reasons; in former times, it was used to  write output loops for time delays and
 
140
occasionally to change interfaces depending on the line speed.</p>
 
141
</dd></dl>
 
142
 
 
143
<dl class="function">
 
144
<dt id="curses.beep">
 
145
<code class="descclassname">curses.</code><code class="descname">beep</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#curses.beep" title="Permalink to this definition">¶</a></dt>
 
146
<dd><p>Emit a short attention sound.</p>
 
147
</dd></dl>
 
148
 
 
149
<dl class="function">
 
150
<dt id="curses.can_change_color">
 
151
<code class="descclassname">curses.</code><code class="descname">can_change_color</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#curses.can_change_color" title="Permalink to this definition">¶</a></dt>
 
152
<dd><p>Return <code class="docutils literal"><span class="pre">True</span></code> or <code class="docutils literal"><span class="pre">False</span></code>, depending on whether the programmer can change the colors
 
153
displayed by the terminal.</p>
 
154
</dd></dl>
 
155
 
 
156
<dl class="function">
 
157
<dt id="curses.cbreak">
 
158
<code class="descclassname">curses.</code><code class="descname">cbreak</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#curses.cbreak" title="Permalink to this definition">¶</a></dt>
 
159
<dd><p>Enter cbreak mode.  In cbreak mode (sometimes called &#8220;rare&#8221; mode) normal tty
 
160
line buffering is turned off and characters are available to be read one by one.
 
161
However, unlike raw mode, special characters (interrupt, quit, suspend, and flow
 
162
control) retain their effects on the tty driver and calling program.  Calling
 
163
first <a class="reference internal" href="#curses.raw" title="curses.raw"><code class="xref py py-func docutils literal"><span class="pre">raw()</span></code></a> then <a class="reference internal" href="#curses.cbreak" title="curses.cbreak"><code class="xref py py-func docutils literal"><span class="pre">cbreak()</span></code></a> leaves the terminal in cbreak mode.</p>
 
164
</dd></dl>
 
165
 
 
166
<dl class="function">
 
167
<dt id="curses.color_content">
 
168
<code class="descclassname">curses.</code><code class="descname">color_content</code><span class="sig-paren">(</span><em>color_number</em><span class="sig-paren">)</span><a class="headerlink" href="#curses.color_content" title="Permalink to this definition">¶</a></dt>
 
169
<dd><p>Return the intensity of the red, green, and blue (RGB) components in the color
 
170
<em>color_number</em>, which must be between <code class="docutils literal"><span class="pre">0</span></code> and <code class="xref py py-const docutils literal"><span class="pre">COLORS</span></code>.  A 3-tuple is
 
171
returned, containing the R,G,B values for the given color, which will be between
 
172
<code class="docutils literal"><span class="pre">0</span></code> (no component) and <code class="docutils literal"><span class="pre">1000</span></code> (maximum amount of component).</p>
 
173
</dd></dl>
 
174
 
 
175
<dl class="function">
 
176
<dt id="curses.color_pair">
 
177
<code class="descclassname">curses.</code><code class="descname">color_pair</code><span class="sig-paren">(</span><em>color_number</em><span class="sig-paren">)</span><a class="headerlink" href="#curses.color_pair" title="Permalink to this definition">¶</a></dt>
 
178
<dd><p>Return the attribute value for displaying text in the specified color.  This
 
179
attribute value can be combined with <code class="xref py py-const docutils literal"><span class="pre">A_STANDOUT</span></code>, <code class="xref py py-const docutils literal"><span class="pre">A_REVERSE</span></code>,
 
180
and the other <code class="xref py py-const docutils literal"><span class="pre">A_*</span></code> attributes.  <a class="reference internal" href="#curses.pair_number" title="curses.pair_number"><code class="xref py py-func docutils literal"><span class="pre">pair_number()</span></code></a> is the counterpart
 
181
to this function.</p>
 
182
</dd></dl>
 
183
 
 
184
<dl class="function">
 
185
<dt id="curses.curs_set">
 
186
<code class="descclassname">curses.</code><code class="descname">curs_set</code><span class="sig-paren">(</span><em>visibility</em><span class="sig-paren">)</span><a class="headerlink" href="#curses.curs_set" title="Permalink to this definition">¶</a></dt>
 
187
<dd><p>Set the cursor state.  <em>visibility</em> can be set to 0, 1, or 2, for invisible,
 
188
normal, or very visible.  If the terminal supports the visibility requested, the
 
189
previous cursor state is returned; otherwise, an exception is raised.  On many
 
190
terminals, the &#8220;visible&#8221; mode is an underline cursor and the &#8220;very visible&#8221; mode
 
191
is a block cursor.</p>
 
192
</dd></dl>
 
193
 
 
194
<dl class="function">
 
195
<dt id="curses.def_prog_mode">
 
196
<code class="descclassname">curses.</code><code class="descname">def_prog_mode</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#curses.def_prog_mode" title="Permalink to this definition">¶</a></dt>
 
197
<dd><p>Save the current terminal mode as the &#8220;program&#8221; mode, the mode when the running
 
198
program is using curses.  (Its counterpart is the &#8220;shell&#8221; mode, for when the
 
199
program is not in curses.)  Subsequent calls to <a class="reference internal" href="#curses.reset_prog_mode" title="curses.reset_prog_mode"><code class="xref py py-func docutils literal"><span class="pre">reset_prog_mode()</span></code></a> will
 
200
restore this mode.</p>
 
201
</dd></dl>
 
202
 
 
203
<dl class="function">
 
204
<dt id="curses.def_shell_mode">
 
205
<code class="descclassname">curses.</code><code class="descname">def_shell_mode</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#curses.def_shell_mode" title="Permalink to this definition">¶</a></dt>
 
206
<dd><p>Save the current terminal mode as the &#8220;shell&#8221; mode, the mode when the running
 
207
program is not using curses.  (Its counterpart is the &#8220;program&#8221; mode, when the
 
208
program is using curses capabilities.) Subsequent calls to
 
209
<a class="reference internal" href="#curses.reset_shell_mode" title="curses.reset_shell_mode"><code class="xref py py-func docutils literal"><span class="pre">reset_shell_mode()</span></code></a> will restore this mode.</p>
 
210
</dd></dl>
 
211
 
 
212
<dl class="function">
 
213
<dt id="curses.delay_output">
 
214
<code class="descclassname">curses.</code><code class="descname">delay_output</code><span class="sig-paren">(</span><em>ms</em><span class="sig-paren">)</span><a class="headerlink" href="#curses.delay_output" title="Permalink to this definition">¶</a></dt>
 
215
<dd><p>Insert an <em>ms</em> millisecond pause in output.</p>
 
216
</dd></dl>
 
217
 
 
218
<dl class="function">
 
219
<dt id="curses.doupdate">
 
220
<code class="descclassname">curses.</code><code class="descname">doupdate</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#curses.doupdate" title="Permalink to this definition">¶</a></dt>
 
221
<dd><p>Update the physical screen.  The curses library keeps two data structures, one
 
222
representing the current physical screen contents and a virtual screen
 
223
representing the desired next state.  The <a class="reference internal" href="#curses.doupdate" title="curses.doupdate"><code class="xref py py-func docutils literal"><span class="pre">doupdate()</span></code></a> ground updates the
 
224
physical screen to match the virtual screen.</p>
 
225
<p>The virtual screen may be updated by a <code class="xref py py-meth docutils literal"><span class="pre">noutrefresh()</span></code> call after write
 
226
operations such as <code class="xref py py-meth docutils literal"><span class="pre">addstr()</span></code> have been performed on a window.  The normal
 
227
<code class="xref py py-meth docutils literal"><span class="pre">refresh()</span></code> call is simply <code class="xref py py-meth docutils literal"><span class="pre">noutrefresh()</span></code> followed by <a class="reference internal" href="#curses.doupdate" title="curses.doupdate"><code class="xref py py-func docutils literal"><span class="pre">doupdate()</span></code></a>;
 
228
if you have to update multiple windows, you can speed performance and perhaps
 
229
reduce screen flicker by issuing <code class="xref py py-meth docutils literal"><span class="pre">noutrefresh()</span></code> calls on all windows,
 
230
followed by a single <a class="reference internal" href="#curses.doupdate" title="curses.doupdate"><code class="xref py py-func docutils literal"><span class="pre">doupdate()</span></code></a>.</p>
 
231
</dd></dl>
 
232
 
 
233
<dl class="function">
 
234
<dt id="curses.echo">
 
235
<code class="descclassname">curses.</code><code class="descname">echo</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#curses.echo" title="Permalink to this definition">¶</a></dt>
 
236
<dd><p>Enter echo mode.  In echo mode, each character input is echoed to the screen as
 
237
it is entered.</p>
 
238
</dd></dl>
 
239
 
 
240
<dl class="function">
 
241
<dt id="curses.endwin">
 
242
<code class="descclassname">curses.</code><code class="descname">endwin</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#curses.endwin" title="Permalink to this definition">¶</a></dt>
 
243
<dd><p>De-initialize the library, and return terminal to normal status.</p>
 
244
</dd></dl>
 
245
 
 
246
<dl class="function">
 
247
<dt id="curses.erasechar">
 
248
<code class="descclassname">curses.</code><code class="descname">erasechar</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#curses.erasechar" title="Permalink to this definition">¶</a></dt>
 
249
<dd><p>Return the user&#8217;s current erase character.  Under Unix operating systems this
 
250
is a property of the controlling tty of the curses program, and is not set by
 
251
the curses library itself.</p>
 
252
</dd></dl>
 
253
 
 
254
<dl class="function">
 
255
<dt id="curses.filter">
 
256
<code class="descclassname">curses.</code><code class="descname">filter</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#curses.filter" title="Permalink to this definition">¶</a></dt>
 
257
<dd><p>The <a class="reference internal" href="#curses.filter" title="curses.filter"><code class="xref py py-func docutils literal"><span class="pre">filter()</span></code></a> routine, if used, must be called before <a class="reference internal" href="#curses.initscr" title="curses.initscr"><code class="xref py py-func docutils literal"><span class="pre">initscr()</span></code></a> is
 
258
called.  The effect is that, during those calls, <span class="target" id="index-0"></span><code class="xref std std-envvar docutils literal"><span class="pre">LINES</span></code> is set to 1; the
 
259
capabilities clear, cup, cud, cud1, cuu1, cuu, vpa are disabled; and the home
 
260
string is set to the value of cr. The effect is that the cursor is confined to
 
261
the current line, and so are screen updates.  This may be used for enabling
 
262
character-at-a-time  line editing without touching the rest of the screen.</p>
 
263
</dd></dl>
 
264
 
 
265
<dl class="function">
 
266
<dt id="curses.flash">
 
267
<code class="descclassname">curses.</code><code class="descname">flash</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#curses.flash" title="Permalink to this definition">¶</a></dt>
 
268
<dd><p>Flash the screen.  That is, change it to reverse-video and then change it back
 
269
in a short interval.  Some people prefer such as &#8216;visible bell&#8217; to the audible
 
270
attention signal produced by <a class="reference internal" href="#curses.beep" title="curses.beep"><code class="xref py py-func docutils literal"><span class="pre">beep()</span></code></a>.</p>
 
271
</dd></dl>
 
272
 
 
273
<dl class="function">
 
274
<dt id="curses.flushinp">
 
275
<code class="descclassname">curses.</code><code class="descname">flushinp</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#curses.flushinp" title="Permalink to this definition">¶</a></dt>
 
276
<dd><p>Flush all input buffers.  This throws away any  typeahead  that  has been typed
 
277
by the user and has not yet been processed by the program.</p>
 
278
</dd></dl>
 
279
 
 
280
<dl class="function">
 
281
<dt id="curses.getmouse">
 
282
<code class="descclassname">curses.</code><code class="descname">getmouse</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#curses.getmouse" title="Permalink to this definition">¶</a></dt>
 
283
<dd><p>After <code class="xref py py-meth docutils literal"><span class="pre">getch()</span></code> returns <code class="xref py py-const docutils literal"><span class="pre">KEY_MOUSE</span></code> to signal a mouse event, this
 
284
method should be call to retrieve the queued mouse event, represented as a
 
285
5-tuple <code class="docutils literal"><span class="pre">(id,</span> <span class="pre">x,</span> <span class="pre">y,</span> <span class="pre">z,</span> <span class="pre">bstate)</span></code>. <em>id</em> is an ID value used to distinguish
 
286
multiple devices, and <em>x</em>, <em>y</em>, <em>z</em> are the event&#8217;s coordinates.  (<em>z</em> is
 
287
currently unused.)  <em>bstate</em> is an integer value whose bits will be set to
 
288
indicate the type of event, and will be the bitwise OR of one or more of the
 
289
following constants, where <em>n</em> is the button number from 1 to 4:
 
290
<code class="xref py py-const docutils literal"><span class="pre">BUTTONn_PRESSED</span></code>, <code class="xref py py-const docutils literal"><span class="pre">BUTTONn_RELEASED</span></code>, <code class="xref py py-const docutils literal"><span class="pre">BUTTONn_CLICKED</span></code>,
 
291
<code class="xref py py-const docutils literal"><span class="pre">BUTTONn_DOUBLE_CLICKED</span></code>, <code class="xref py py-const docutils literal"><span class="pre">BUTTONn_TRIPLE_CLICKED</span></code>,
 
292
<code class="xref py py-const docutils literal"><span class="pre">BUTTON_SHIFT</span></code>, <code class="xref py py-const docutils literal"><span class="pre">BUTTON_CTRL</span></code>, <code class="xref py py-const docutils literal"><span class="pre">BUTTON_ALT</span></code>.</p>
 
293
</dd></dl>
 
294
 
 
295
<dl class="function">
 
296
<dt id="curses.getsyx">
 
297
<code class="descclassname">curses.</code><code class="descname">getsyx</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#curses.getsyx" title="Permalink to this definition">¶</a></dt>
 
298
<dd><p>Return the current coordinates of the virtual screen cursor in y and x.  If
 
299
leaveok is currently true, then -1,-1 is returned.</p>
 
300
</dd></dl>
 
301
 
 
302
<dl class="function">
 
303
<dt id="curses.getwin">
 
304
<code class="descclassname">curses.</code><code class="descname">getwin</code><span class="sig-paren">(</span><em>file</em><span class="sig-paren">)</span><a class="headerlink" href="#curses.getwin" title="Permalink to this definition">¶</a></dt>
 
305
<dd><p>Read window related data stored in the file by an earlier <code class="xref py py-func docutils literal"><span class="pre">putwin()</span></code> call.
 
306
The routine then creates and initializes a new window using that data, returning
 
307
the new window object.</p>
 
308
</dd></dl>
 
309
 
 
310
<dl class="function">
 
311
<dt id="curses.has_colors">
 
312
<code class="descclassname">curses.</code><code class="descname">has_colors</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#curses.has_colors" title="Permalink to this definition">¶</a></dt>
 
313
<dd><p>Return <code class="docutils literal"><span class="pre">True</span></code> if the terminal can display colors; otherwise, return <code class="docutils literal"><span class="pre">False</span></code>.</p>
 
314
</dd></dl>
 
315
 
 
316
<dl class="function">
 
317
<dt id="curses.has_ic">
 
318
<code class="descclassname">curses.</code><code class="descname">has_ic</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#curses.has_ic" title="Permalink to this definition">¶</a></dt>
 
319
<dd><p>Return <code class="docutils literal"><span class="pre">True</span></code> if the terminal has insert- and delete-character capabilities.
 
320
This function is included for historical reasons only, as all modern software
 
321
terminal emulators have such capabilities.</p>
 
322
</dd></dl>
 
323
 
 
324
<dl class="function">
 
325
<dt id="curses.has_il">
 
326
<code class="descclassname">curses.</code><code class="descname">has_il</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#curses.has_il" title="Permalink to this definition">¶</a></dt>
 
327
<dd><p>Return <code class="docutils literal"><span class="pre">True</span></code> if the terminal has insert- and delete-line capabilities, or can
 
328
simulate  them  using scrolling regions. This function is included for
 
329
historical reasons only, as all modern software terminal emulators have such
 
330
capabilities.</p>
 
331
</dd></dl>
 
332
 
 
333
<dl class="function">
 
334
<dt id="curses.has_key">
 
335
<code class="descclassname">curses.</code><code class="descname">has_key</code><span class="sig-paren">(</span><em>ch</em><span class="sig-paren">)</span><a class="headerlink" href="#curses.has_key" title="Permalink to this definition">¶</a></dt>
 
336
<dd><p>Take a key value <em>ch</em>, and return <code class="docutils literal"><span class="pre">True</span></code> if the current terminal type recognizes
 
337
a key with that value.</p>
 
338
</dd></dl>
 
339
 
 
340
<dl class="function">
 
341
<dt id="curses.halfdelay">
 
342
<code class="descclassname">curses.</code><code class="descname">halfdelay</code><span class="sig-paren">(</span><em>tenths</em><span class="sig-paren">)</span><a class="headerlink" href="#curses.halfdelay" title="Permalink to this definition">¶</a></dt>
 
343
<dd><p>Used for half-delay mode, which is similar to cbreak mode in that characters
 
344
typed by the user are immediately available to the program. However, after
 
345
blocking for <em>tenths</em> tenths of seconds, an exception is raised if nothing has
 
346
been typed.  The value of <em>tenths</em> must be a number between <code class="docutils literal"><span class="pre">1</span></code> and <code class="docutils literal"><span class="pre">255</span></code>.  Use
 
347
<a class="reference internal" href="#curses.nocbreak" title="curses.nocbreak"><code class="xref py py-func docutils literal"><span class="pre">nocbreak()</span></code></a> to leave half-delay mode.</p>
 
348
</dd></dl>
 
349
 
 
350
<dl class="function">
 
351
<dt id="curses.init_color">
 
352
<code class="descclassname">curses.</code><code class="descname">init_color</code><span class="sig-paren">(</span><em>color_number</em>, <em>r</em>, <em>g</em>, <em>b</em><span class="sig-paren">)</span><a class="headerlink" href="#curses.init_color" title="Permalink to this definition">¶</a></dt>
 
353
<dd><p>Change the definition of a color, taking the number of the color to be changed
 
354
followed by three RGB values (for the amounts of red, green, and blue
 
355
components).  The value of <em>color_number</em> must be between <code class="docutils literal"><span class="pre">0</span></code> and
 
356
<code class="xref py py-const docutils literal"><span class="pre">COLORS</span></code>.  Each of <em>r</em>, <em>g</em>, <em>b</em>, must be a value between <code class="docutils literal"><span class="pre">0</span></code> and
 
357
<code class="docutils literal"><span class="pre">1000</span></code>.  When <a class="reference internal" href="#curses.init_color" title="curses.init_color"><code class="xref py py-func docutils literal"><span class="pre">init_color()</span></code></a> is used, all occurrences of that color on the
 
358
screen immediately change to the new definition.  This function is a no-op on
 
359
most terminals; it is active only if <a class="reference internal" href="#curses.can_change_color" title="curses.can_change_color"><code class="xref py py-func docutils literal"><span class="pre">can_change_color()</span></code></a> returns <code class="docutils literal"><span class="pre">1</span></code>.</p>
 
360
</dd></dl>
 
361
 
 
362
<dl class="function">
 
363
<dt id="curses.init_pair">
 
364
<code class="descclassname">curses.</code><code class="descname">init_pair</code><span class="sig-paren">(</span><em>pair_number</em>, <em>fg</em>, <em>bg</em><span class="sig-paren">)</span><a class="headerlink" href="#curses.init_pair" title="Permalink to this definition">¶</a></dt>
 
365
<dd><p>Change the definition of a color-pair.  It takes three arguments: the number of
 
366
the color-pair to be changed, the foreground color number, and the background
 
367
color number.  The value of <em>pair_number</em> must be between <code class="docutils literal"><span class="pre">1</span></code> and
 
368
<code class="docutils literal"><span class="pre">COLOR_PAIRS</span> <span class="pre">-</span> <span class="pre">1</span></code> (the <code class="docutils literal"><span class="pre">0</span></code> color pair is wired to white on black and cannot
 
369
be changed).  The value of <em>fg</em> and <em>bg</em> arguments must be between <code class="docutils literal"><span class="pre">0</span></code> and
 
370
<code class="xref py py-const docutils literal"><span class="pre">COLORS</span></code>.  If the color-pair was previously initialized, the screen is
 
371
refreshed and all occurrences of that color-pair are changed to the new
 
372
definition.</p>
 
373
</dd></dl>
 
374
 
 
375
<dl class="function">
 
376
<dt id="curses.initscr">
 
377
<code class="descclassname">curses.</code><code class="descname">initscr</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#curses.initscr" title="Permalink to this definition">¶</a></dt>
 
378
<dd><p>Initialize the library. Return a <code class="xref py py-class docutils literal"><span class="pre">WindowObject</span></code> which represents the
 
379
whole screen.</p>
 
380
<div class="admonition note">
 
381
<p class="first admonition-title">Note</p>
 
382
<p class="last">If there is an error opening the terminal, the underlying curses library may
 
383
cause the interpreter to exit.</p>
 
384
</div>
 
385
</dd></dl>
 
386
 
 
387
<dl class="function">
 
388
<dt id="curses.is_term_resized">
 
389
<code class="descclassname">curses.</code><code class="descname">is_term_resized</code><span class="sig-paren">(</span><em>nlines</em>, <em>ncols</em><span class="sig-paren">)</span><a class="headerlink" href="#curses.is_term_resized" title="Permalink to this definition">¶</a></dt>
 
390
<dd><p>Return <code class="docutils literal"><span class="pre">True</span></code> if <a class="reference internal" href="#curses.resize_term" title="curses.resize_term"><code class="xref py py-func docutils literal"><span class="pre">resize_term()</span></code></a> would modify the window structure,
 
391
<code class="docutils literal"><span class="pre">False</span></code> otherwise.</p>
 
392
</dd></dl>
 
393
 
 
394
<dl class="function">
 
395
<dt id="curses.isendwin">
 
396
<code class="descclassname">curses.</code><code class="descname">isendwin</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#curses.isendwin" title="Permalink to this definition">¶</a></dt>
 
397
<dd><p>Return <code class="docutils literal"><span class="pre">True</span></code> if <a class="reference internal" href="#curses.endwin" title="curses.endwin"><code class="xref py py-func docutils literal"><span class="pre">endwin()</span></code></a> has been called (that is, the  curses library has
 
398
been deinitialized).</p>
 
399
</dd></dl>
 
400
 
 
401
<dl class="function">
 
402
<dt id="curses.keyname">
 
403
<code class="descclassname">curses.</code><code class="descname">keyname</code><span class="sig-paren">(</span><em>k</em><span class="sig-paren">)</span><a class="headerlink" href="#curses.keyname" title="Permalink to this definition">¶</a></dt>
 
404
<dd><p>Return the name of the key numbered <em>k</em>.  The name of a key generating printable
 
405
ASCII character is the key&#8217;s character.  The name of a control-key combination
 
406
is a two-character string consisting of a caret followed by the corresponding
 
407
printable ASCII character.  The name of an alt-key combination (128&#8211;255) is a
 
408
string consisting of the prefix &#8216;M-&#8216; followed by the name of the corresponding
 
409
ASCII character.</p>
 
410
</dd></dl>
 
411
 
 
412
<dl class="function">
 
413
<dt id="curses.killchar">
 
414
<code class="descclassname">curses.</code><code class="descname">killchar</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#curses.killchar" title="Permalink to this definition">¶</a></dt>
 
415
<dd><p>Return the user&#8217;s current line kill character. Under Unix operating systems
 
416
this is a property of the controlling tty of the curses program, and is not set
 
417
by the curses library itself.</p>
 
418
</dd></dl>
 
419
 
 
420
<dl class="function">
 
421
<dt id="curses.longname">
 
422
<code class="descclassname">curses.</code><code class="descname">longname</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#curses.longname" title="Permalink to this definition">¶</a></dt>
 
423
<dd><p>Return a string containing the terminfo long name field describing the current
 
424
terminal.  The maximum length of a verbose description is 128 characters.  It is
 
425
defined only after the call to <a class="reference internal" href="#curses.initscr" title="curses.initscr"><code class="xref py py-func docutils literal"><span class="pre">initscr()</span></code></a>.</p>
 
426
</dd></dl>
 
427
 
 
428
<dl class="function">
 
429
<dt id="curses.meta">
 
430
<code class="descclassname">curses.</code><code class="descname">meta</code><span class="sig-paren">(</span><em>yes</em><span class="sig-paren">)</span><a class="headerlink" href="#curses.meta" title="Permalink to this definition">¶</a></dt>
 
431
<dd><p>If <em>yes</em> is 1, allow 8-bit characters to be input. If <em>yes</em> is 0,  allow only
 
432
7-bit chars.</p>
 
433
</dd></dl>
 
434
 
 
435
<dl class="function">
 
436
<dt id="curses.mouseinterval">
 
437
<code class="descclassname">curses.</code><code class="descname">mouseinterval</code><span class="sig-paren">(</span><em>interval</em><span class="sig-paren">)</span><a class="headerlink" href="#curses.mouseinterval" title="Permalink to this definition">¶</a></dt>
 
438
<dd><p>Set the maximum time in milliseconds that can elapse between press and release
 
439
events in order for them to be recognized as a click, and return the previous
 
440
interval value.  The default value is 200 msec, or one fifth of a second.</p>
 
441
</dd></dl>
 
442
 
 
443
<dl class="function">
 
444
<dt id="curses.mousemask">
 
445
<code class="descclassname">curses.</code><code class="descname">mousemask</code><span class="sig-paren">(</span><em>mousemask</em><span class="sig-paren">)</span><a class="headerlink" href="#curses.mousemask" title="Permalink to this definition">¶</a></dt>
 
446
<dd><p>Set the mouse events to be reported, and return a tuple <code class="docutils literal"><span class="pre">(availmask,</span>
 
447
<span class="pre">oldmask)</span></code>.   <em>availmask</em> indicates which of the specified mouse events can be
 
448
reported; on complete failure it returns 0.  <em>oldmask</em> is the previous value of
 
449
the given window&#8217;s mouse event mask.  If this function is never called, no mouse
 
450
events are ever reported.</p>
 
451
</dd></dl>
 
452
 
 
453
<dl class="function">
 
454
<dt id="curses.napms">
 
455
<code class="descclassname">curses.</code><code class="descname">napms</code><span class="sig-paren">(</span><em>ms</em><span class="sig-paren">)</span><a class="headerlink" href="#curses.napms" title="Permalink to this definition">¶</a></dt>
 
456
<dd><p>Sleep for <em>ms</em> milliseconds.</p>
 
457
</dd></dl>
 
458
 
 
459
<dl class="function">
 
460
<dt id="curses.newpad">
 
461
<code class="descclassname">curses.</code><code class="descname">newpad</code><span class="sig-paren">(</span><em>nlines</em>, <em>ncols</em><span class="sig-paren">)</span><a class="headerlink" href="#curses.newpad" title="Permalink to this definition">¶</a></dt>
 
462
<dd><p>Create and return a pointer to a new pad data structure with the given number
 
463
of lines and columns.  A pad is returned as a window object.</p>
 
464
<p>A pad is like a window, except that it is not restricted by the screen size, and
 
465
is not necessarily associated with a particular part of the screen.  Pads can be
 
466
used when a large window is needed, and only a part of the window will be on the
 
467
screen at one time.  Automatic refreshes of pads (such as from scrolling or
 
468
echoing of input) do not occur.  The <code class="xref py py-meth docutils literal"><span class="pre">refresh()</span></code> and <code class="xref py py-meth docutils literal"><span class="pre">noutrefresh()</span></code>
 
469
methods of a pad require 6 arguments to specify the part of the pad to be
 
470
displayed and the location on the screen to be used for the display. The
 
471
arguments are <em>pminrow</em>, <em>pmincol</em>, <em>sminrow</em>, <em>smincol</em>, <em>smaxrow</em>, <em>smaxcol</em>; the <em>p</em>
 
472
arguments refer to the upper left corner of the pad region to be displayed and
 
473
the <em>s</em> arguments define a clipping box on the screen within which the pad region
 
474
is to be displayed.</p>
 
475
</dd></dl>
 
476
 
 
477
<dl class="function">
 
478
<dt id="curses.newwin">
 
479
<code class="descclassname">curses.</code><code class="descname">newwin</code><span class="sig-paren">(</span><em>nlines</em>, <em>ncols</em><span class="sig-paren">)</span><a class="headerlink" href="#curses.newwin" title="Permalink to this definition">¶</a></dt>
 
480
<dt>
 
481
<code class="descclassname">curses.</code><code class="descname">newwin</code><span class="sig-paren">(</span><em>nlines</em>, <em>ncols</em>, <em>begin_y</em>, <em>begin_x</em><span class="sig-paren">)</span></dt>
 
482
<dd><p>Return a new window, whose left-upper corner is at  <code class="docutils literal"><span class="pre">(begin_y,</span> <span class="pre">begin_x)</span></code>, and
 
483
whose height/width is  <em>nlines</em>/<em>ncols</em>.</p>
 
484
<p>By default, the window will extend from the  specified position to the lower
 
485
right corner of the screen.</p>
 
486
</dd></dl>
 
487
 
 
488
<dl class="function">
 
489
<dt id="curses.nl">
 
490
<code class="descclassname">curses.</code><code class="descname">nl</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#curses.nl" title="Permalink to this definition">¶</a></dt>
 
491
<dd><p>Enter newline mode.  This mode translates the return key into newline on input,
 
492
and translates newline into return and line-feed on output. Newline mode is
 
493
initially on.</p>
 
494
</dd></dl>
 
495
 
 
496
<dl class="function">
 
497
<dt id="curses.nocbreak">
 
498
<code class="descclassname">curses.</code><code class="descname">nocbreak</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#curses.nocbreak" title="Permalink to this definition">¶</a></dt>
 
499
<dd><p>Leave cbreak mode.  Return to normal &#8220;cooked&#8221; mode with line buffering.</p>
 
500
</dd></dl>
 
501
 
 
502
<dl class="function">
 
503
<dt id="curses.noecho">
 
504
<code class="descclassname">curses.</code><code class="descname">noecho</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#curses.noecho" title="Permalink to this definition">¶</a></dt>
 
505
<dd><p>Leave echo mode.  Echoing of input characters is turned off.</p>
 
506
</dd></dl>
 
507
 
 
508
<dl class="function">
 
509
<dt id="curses.nonl">
 
510
<code class="descclassname">curses.</code><code class="descname">nonl</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#curses.nonl" title="Permalink to this definition">¶</a></dt>
 
511
<dd><p>Leave newline mode.  Disable translation of return into newline on input, and
 
512
disable low-level translation of newline into newline/return on output (but this
 
513
does not change the behavior of <code class="docutils literal"><span class="pre">addch('\n')</span></code>, which always does the
 
514
equivalent of return and line feed on the virtual screen).  With translation
 
515
off, curses can sometimes speed up vertical motion a little; also, it will be
 
516
able to detect the return key on input.</p>
 
517
</dd></dl>
 
518
 
 
519
<dl class="function">
 
520
<dt id="curses.noqiflush">
 
521
<code class="descclassname">curses.</code><code class="descname">noqiflush</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#curses.noqiflush" title="Permalink to this definition">¶</a></dt>
 
522
<dd><p>When the <a class="reference internal" href="#curses.noqiflush" title="curses.noqiflush"><code class="xref py py-func docutils literal"><span class="pre">noqiflush()</span></code></a> routine is used, normal flush of input and output queues
 
523
associated with the INTR, QUIT and SUSP characters will not be done.  You may
 
524
want to call <a class="reference internal" href="#curses.noqiflush" title="curses.noqiflush"><code class="xref py py-func docutils literal"><span class="pre">noqiflush()</span></code></a> in a signal handler if you want output to
 
525
continue as though the interrupt had not occurred, after the handler exits.</p>
 
526
</dd></dl>
 
527
 
 
528
<dl class="function">
 
529
<dt id="curses.noraw">
 
530
<code class="descclassname">curses.</code><code class="descname">noraw</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#curses.noraw" title="Permalink to this definition">¶</a></dt>
 
531
<dd><p>Leave raw mode. Return to normal &#8220;cooked&#8221; mode with line buffering.</p>
 
532
</dd></dl>
 
533
 
 
534
<dl class="function">
 
535
<dt id="curses.pair_content">
 
536
<code class="descclassname">curses.</code><code class="descname">pair_content</code><span class="sig-paren">(</span><em>pair_number</em><span class="sig-paren">)</span><a class="headerlink" href="#curses.pair_content" title="Permalink to this definition">¶</a></dt>
 
537
<dd><p>Return a tuple <code class="docutils literal"><span class="pre">(fg,</span> <span class="pre">bg)</span></code> containing the colors for the requested color pair.
 
538
The value of <em>pair_number</em> must be between <code class="docutils literal"><span class="pre">1</span></code> and <code class="docutils literal"><span class="pre">COLOR_PAIRS</span> <span class="pre">-</span> <span class="pre">1</span></code>.</p>
 
539
</dd></dl>
 
540
 
 
541
<dl class="function">
 
542
<dt id="curses.pair_number">
 
543
<code class="descclassname">curses.</code><code class="descname">pair_number</code><span class="sig-paren">(</span><em>attr</em><span class="sig-paren">)</span><a class="headerlink" href="#curses.pair_number" title="Permalink to this definition">¶</a></dt>
 
544
<dd><p>Return the number of the color-pair set by the attribute value <em>attr</em>.
 
545
<a class="reference internal" href="#curses.color_pair" title="curses.color_pair"><code class="xref py py-func docutils literal"><span class="pre">color_pair()</span></code></a> is the counterpart to this function.</p>
 
546
</dd></dl>
 
547
 
 
548
<dl class="function">
 
549
<dt id="curses.putp">
 
550
<code class="descclassname">curses.</code><code class="descname">putp</code><span class="sig-paren">(</span><em>string</em><span class="sig-paren">)</span><a class="headerlink" href="#curses.putp" title="Permalink to this definition">¶</a></dt>
 
551
<dd><p>Equivalent to <code class="docutils literal"><span class="pre">tputs(str,</span> <span class="pre">1,</span> <span class="pre">putchar)</span></code>; emit the value of a specified
 
552
terminfo capability for the current terminal.  Note that the output of <a class="reference internal" href="#curses.putp" title="curses.putp"><code class="xref py py-func docutils literal"><span class="pre">putp()</span></code></a>
 
553
always goes to standard output.</p>
 
554
</dd></dl>
 
555
 
 
556
<dl class="function">
 
557
<dt id="curses.qiflush">
 
558
<code class="descclassname">curses.</code><code class="descname">qiflush</code><span class="sig-paren">(</span><span class="optional">[</span><em>flag</em><span class="optional">]</span><span class="sig-paren">)</span><a class="headerlink" href="#curses.qiflush" title="Permalink to this definition">¶</a></dt>
 
559
<dd><p>If <em>flag</em> is <code class="docutils literal"><span class="pre">False</span></code>, the effect is the same as calling <a class="reference internal" href="#curses.noqiflush" title="curses.noqiflush"><code class="xref py py-func docutils literal"><span class="pre">noqiflush()</span></code></a>. If
 
560
<em>flag</em> is <code class="docutils literal"><span class="pre">True</span></code>, or no argument is provided, the queues will be flushed when
 
561
these control characters are read.</p>
 
562
</dd></dl>
 
563
 
 
564
<dl class="function">
 
565
<dt id="curses.raw">
 
566
<code class="descclassname">curses.</code><code class="descname">raw</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#curses.raw" title="Permalink to this definition">¶</a></dt>
 
567
<dd><p>Enter raw mode.  In raw mode, normal line buffering and  processing of
 
568
interrupt, quit, suspend, and flow control keys are turned off; characters are
 
569
presented to curses input functions one by one.</p>
 
570
</dd></dl>
 
571
 
 
572
<dl class="function">
 
573
<dt id="curses.reset_prog_mode">
 
574
<code class="descclassname">curses.</code><code class="descname">reset_prog_mode</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#curses.reset_prog_mode" title="Permalink to this definition">¶</a></dt>
 
575
<dd><p>Restore the  terminal  to &#8220;program&#8221; mode, as previously saved  by
 
576
<a class="reference internal" href="#curses.def_prog_mode" title="curses.def_prog_mode"><code class="xref py py-func docutils literal"><span class="pre">def_prog_mode()</span></code></a>.</p>
 
577
</dd></dl>
 
578
 
 
579
<dl class="function">
 
580
<dt id="curses.reset_shell_mode">
 
581
<code class="descclassname">curses.</code><code class="descname">reset_shell_mode</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#curses.reset_shell_mode" title="Permalink to this definition">¶</a></dt>
 
582
<dd><p>Restore the  terminal  to &#8220;shell&#8221; mode, as previously saved  by
 
583
<a class="reference internal" href="#curses.def_shell_mode" title="curses.def_shell_mode"><code class="xref py py-func docutils literal"><span class="pre">def_shell_mode()</span></code></a>.</p>
 
584
</dd></dl>
 
585
 
 
586
<dl class="function">
 
587
<dt id="curses.resetty">
 
588
<code class="descclassname">curses.</code><code class="descname">resetty</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#curses.resetty" title="Permalink to this definition">¶</a></dt>
 
589
<dd><p>Restore the state of the terminal modes to what it was at the last call to
 
590
<a class="reference internal" href="#curses.savetty" title="curses.savetty"><code class="xref py py-func docutils literal"><span class="pre">savetty()</span></code></a>.</p>
 
591
</dd></dl>
 
592
 
 
593
<dl class="function">
 
594
<dt id="curses.resize_term">
 
595
<code class="descclassname">curses.</code><code class="descname">resize_term</code><span class="sig-paren">(</span><em>nlines</em>, <em>ncols</em><span class="sig-paren">)</span><a class="headerlink" href="#curses.resize_term" title="Permalink to this definition">¶</a></dt>
 
596
<dd><p>Backend function used by <a class="reference internal" href="#curses.resizeterm" title="curses.resizeterm"><code class="xref py py-func docutils literal"><span class="pre">resizeterm()</span></code></a>, performing most of the work;
 
597
when resizing the windows, <a class="reference internal" href="#curses.resize_term" title="curses.resize_term"><code class="xref py py-func docutils literal"><span class="pre">resize_term()</span></code></a> blank-fills the areas that are
 
598
extended.  The calling application should fill in these areas with
 
599
appropriate data.  The <a class="reference internal" href="#curses.resize_term" title="curses.resize_term"><code class="xref py py-func docutils literal"><span class="pre">resize_term()</span></code></a> function attempts to resize all
 
600
windows.  However, due to the calling convention of pads, it is not possible
 
601
to resize these without additional interaction with the application.</p>
 
602
</dd></dl>
 
603
 
 
604
<dl class="function">
 
605
<dt id="curses.resizeterm">
 
606
<code class="descclassname">curses.</code><code class="descname">resizeterm</code><span class="sig-paren">(</span><em>nlines</em>, <em>ncols</em><span class="sig-paren">)</span><a class="headerlink" href="#curses.resizeterm" title="Permalink to this definition">¶</a></dt>
 
607
<dd><p>Resize the standard and current windows to the specified dimensions, and
 
608
adjusts other bookkeeping data used by the curses library that record the
 
609
window dimensions (in particular the SIGWINCH handler).</p>
 
610
</dd></dl>
 
611
 
 
612
<dl class="function">
 
613
<dt id="curses.savetty">
 
614
<code class="descclassname">curses.</code><code class="descname">savetty</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#curses.savetty" title="Permalink to this definition">¶</a></dt>
 
615
<dd><p>Save the current state of the terminal modes in a buffer, usable by
 
616
<a class="reference internal" href="#curses.resetty" title="curses.resetty"><code class="xref py py-func docutils literal"><span class="pre">resetty()</span></code></a>.</p>
 
617
</dd></dl>
 
618
 
 
619
<dl class="function">
 
620
<dt id="curses.setsyx">
 
621
<code class="descclassname">curses.</code><code class="descname">setsyx</code><span class="sig-paren">(</span><em>y</em>, <em>x</em><span class="sig-paren">)</span><a class="headerlink" href="#curses.setsyx" title="Permalink to this definition">¶</a></dt>
 
622
<dd><p>Set the virtual screen cursor to <em>y</em>, <em>x</em>. If <em>y</em> and <em>x</em> are both -1, then
 
623
leaveok is set.</p>
 
624
</dd></dl>
 
625
 
 
626
<dl class="function">
 
627
<dt id="curses.setupterm">
 
628
<code class="descclassname">curses.</code><code class="descname">setupterm</code><span class="sig-paren">(</span><span class="optional">[</span><em>termstr</em>, <em>fd</em><span class="optional">]</span><span class="sig-paren">)</span><a class="headerlink" href="#curses.setupterm" title="Permalink to this definition">¶</a></dt>
 
629
<dd><p>Initialize the terminal.  <em>termstr</em> is a string giving the terminal name; if
 
630
omitted, the value of the <span class="target" id="index-1"></span><code class="xref std std-envvar docutils literal"><span class="pre">TERM</span></code> environment variable will be used.  <em>fd</em> is the
 
631
file descriptor to which any initialization sequences will be sent; if not
 
632
supplied, the file descriptor for <code class="docutils literal"><span class="pre">sys.stdout</span></code> will be used.</p>
 
633
</dd></dl>
 
634
 
 
635
<dl class="function">
 
636
<dt id="curses.start_color">
 
637
<code class="descclassname">curses.</code><code class="descname">start_color</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#curses.start_color" title="Permalink to this definition">¶</a></dt>
 
638
<dd><p>Must be called if the programmer wants to use colors, and before any other color
 
639
manipulation routine is called.  It is good practice to call this routine right
 
640
after <a class="reference internal" href="#curses.initscr" title="curses.initscr"><code class="xref py py-func docutils literal"><span class="pre">initscr()</span></code></a>.</p>
 
641
<p><a class="reference internal" href="#curses.start_color" title="curses.start_color"><code class="xref py py-func docutils literal"><span class="pre">start_color()</span></code></a> initializes eight basic colors (black, red,  green, yellow,
 
642
blue, magenta, cyan, and white), and two global variables in the <a class="reference internal" href="#module-curses" title="curses: An interface to the curses library, providing portable terminal handling. (Unix)"><code class="xref py py-mod docutils literal"><span class="pre">curses</span></code></a>
 
643
module, <code class="xref py py-const docutils literal"><span class="pre">COLORS</span></code> and <code class="xref py py-const docutils literal"><span class="pre">COLOR_PAIRS</span></code>, containing the maximum number
 
644
of colors and color-pairs the terminal can support.  It also restores the colors
 
645
on the terminal to the values they had when the terminal was just turned on.</p>
 
646
</dd></dl>
 
647
 
 
648
<dl class="function">
 
649
<dt id="curses.termattrs">
 
650
<code class="descclassname">curses.</code><code class="descname">termattrs</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#curses.termattrs" title="Permalink to this definition">¶</a></dt>
 
651
<dd><p>Return a logical OR of all video attributes supported by the terminal.  This
 
652
information is useful when a curses program needs complete control over the
 
653
appearance of the screen.</p>
 
654
</dd></dl>
 
655
 
 
656
<dl class="function">
 
657
<dt id="curses.termname">
 
658
<code class="descclassname">curses.</code><code class="descname">termname</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#curses.termname" title="Permalink to this definition">¶</a></dt>
 
659
<dd><p>Return the value of the environment variable <span class="target" id="index-2"></span><code class="xref std std-envvar docutils literal"><span class="pre">TERM</span></code>, truncated to 14 characters.</p>
 
660
</dd></dl>
 
661
 
 
662
<dl class="function">
 
663
<dt id="curses.tigetflag">
 
664
<code class="descclassname">curses.</code><code class="descname">tigetflag</code><span class="sig-paren">(</span><em>capname</em><span class="sig-paren">)</span><a class="headerlink" href="#curses.tigetflag" title="Permalink to this definition">¶</a></dt>
 
665
<dd><p>Return the value of the Boolean capability corresponding to the terminfo
 
666
capability name <em>capname</em>.  The value <code class="docutils literal"><span class="pre">-1</span></code> is returned if <em>capname</em> is not a
 
667
Boolean capability, or <code class="docutils literal"><span class="pre">0</span></code> if it is canceled or absent from the terminal
 
668
description.</p>
 
669
</dd></dl>
 
670
 
 
671
<dl class="function">
 
672
<dt id="curses.tigetnum">
 
673
<code class="descclassname">curses.</code><code class="descname">tigetnum</code><span class="sig-paren">(</span><em>capname</em><span class="sig-paren">)</span><a class="headerlink" href="#curses.tigetnum" title="Permalink to this definition">¶</a></dt>
 
674
<dd><p>Return the value of the numeric capability corresponding to the terminfo
 
675
capability name <em>capname</em>.  The value <code class="docutils literal"><span class="pre">-2</span></code> is returned if <em>capname</em> is not a
 
676
numeric capability, or <code class="docutils literal"><span class="pre">-1</span></code> if it is canceled or absent from the terminal
 
677
description.</p>
 
678
</dd></dl>
 
679
 
 
680
<dl class="function">
 
681
<dt id="curses.tigetstr">
 
682
<code class="descclassname">curses.</code><code class="descname">tigetstr</code><span class="sig-paren">(</span><em>capname</em><span class="sig-paren">)</span><a class="headerlink" href="#curses.tigetstr" title="Permalink to this definition">¶</a></dt>
 
683
<dd><p>Return the value of the string capability corresponding to the terminfo
 
684
capability name <em>capname</em>.  <code class="docutils literal"><span class="pre">None</span></code> is returned if <em>capname</em> is not a string
 
685
capability, or is canceled or absent from the terminal description.</p>
 
686
</dd></dl>
 
687
 
 
688
<dl class="function">
 
689
<dt id="curses.tparm">
 
690
<code class="descclassname">curses.</code><code class="descname">tparm</code><span class="sig-paren">(</span><em>str</em><span class="optional">[</span>, <em>...</em><span class="optional">]</span><span class="sig-paren">)</span><a class="headerlink" href="#curses.tparm" title="Permalink to this definition">¶</a></dt>
 
691
<dd><p>Instantiate the string <em>str</em> with the supplied parameters, where <em>str</em> should
 
692
be a parameterized string obtained from the terminfo database.  E.g.
 
693
<code class="docutils literal"><span class="pre">tparm(tigetstr(&quot;cup&quot;),</span> <span class="pre">5,</span> <span class="pre">3)</span></code> could result in <code class="docutils literal"><span class="pre">'\033[6;4H'</span></code>, the exact
 
694
result depending on terminal type.</p>
 
695
</dd></dl>
 
696
 
 
697
<dl class="function">
 
698
<dt id="curses.typeahead">
 
699
<code class="descclassname">curses.</code><code class="descname">typeahead</code><span class="sig-paren">(</span><em>fd</em><span class="sig-paren">)</span><a class="headerlink" href="#curses.typeahead" title="Permalink to this definition">¶</a></dt>
 
700
<dd><p>Specify that the file descriptor <em>fd</em> be used for typeahead checking.  If <em>fd</em>
 
701
is <code class="docutils literal"><span class="pre">-1</span></code>, then no typeahead checking is done.</p>
 
702
<p>The curses library does &#8220;line-breakout optimization&#8221; by looking for typeahead
 
703
periodically while updating the screen.  If input is found, and it is coming
 
704
from a tty, the current update is postponed until refresh or doupdate is called
 
705
again, allowing faster response to commands typed in advance. This function
 
706
allows specifying a different file descriptor for typeahead checking.</p>
 
707
</dd></dl>
 
708
 
 
709
<dl class="function">
 
710
<dt id="curses.unctrl">
 
711
<code class="descclassname">curses.</code><code class="descname">unctrl</code><span class="sig-paren">(</span><em>ch</em><span class="sig-paren">)</span><a class="headerlink" href="#curses.unctrl" title="Permalink to this definition">¶</a></dt>
 
712
<dd><p>Return a string which is a printable representation of the character <em>ch</em>.
 
713
Control characters are displayed as a caret followed by the character, for
 
714
example as <code class="docutils literal"><span class="pre">^C</span></code>. Printing characters are left as they are.</p>
 
715
</dd></dl>
 
716
 
 
717
<dl class="function">
 
718
<dt id="curses.ungetch">
 
719
<code class="descclassname">curses.</code><code class="descname">ungetch</code><span class="sig-paren">(</span><em>ch</em><span class="sig-paren">)</span><a class="headerlink" href="#curses.ungetch" title="Permalink to this definition">¶</a></dt>
 
720
<dd><p>Push <em>ch</em> so the next <code class="xref py py-meth docutils literal"><span class="pre">getch()</span></code> will return it.</p>
 
721
<div class="admonition note">
 
722
<p class="first admonition-title">Note</p>
 
723
<p class="last">Only one <em>ch</em> can be pushed before <code class="xref py py-meth docutils literal"><span class="pre">getch()</span></code> is called.</p>
 
724
</div>
 
725
</dd></dl>
 
726
 
 
727
<dl class="function">
 
728
<dt id="curses.ungetmouse">
 
729
<code class="descclassname">curses.</code><code class="descname">ungetmouse</code><span class="sig-paren">(</span><em>id</em>, <em>x</em>, <em>y</em>, <em>z</em>, <em>bstate</em><span class="sig-paren">)</span><a class="headerlink" href="#curses.ungetmouse" title="Permalink to this definition">¶</a></dt>
 
730
<dd><p>Push a <code class="xref py py-const docutils literal"><span class="pre">KEY_MOUSE</span></code> event onto the input queue, associating the given
 
731
state data with it.</p>
 
732
</dd></dl>
 
733
 
 
734
<dl class="function">
 
735
<dt id="curses.use_env">
 
736
<code class="descclassname">curses.</code><code class="descname">use_env</code><span class="sig-paren">(</span><em>flag</em><span class="sig-paren">)</span><a class="headerlink" href="#curses.use_env" title="Permalink to this definition">¶</a></dt>
 
737
<dd><p>If used, this function should be called before <a class="reference internal" href="#curses.initscr" title="curses.initscr"><code class="xref py py-func docutils literal"><span class="pre">initscr()</span></code></a> or newterm are
 
738
called.  When <em>flag</em> is <code class="docutils literal"><span class="pre">False</span></code>, the values of lines and columns specified in the
 
739
terminfo database will be used, even if environment variables <span class="target" id="index-3"></span><code class="xref std std-envvar docutils literal"><span class="pre">LINES</span></code>
 
740
and <span class="target" id="index-4"></span><code class="xref std std-envvar docutils literal"><span class="pre">COLUMNS</span></code> (used by default) are set, or if curses is running in a
 
741
window (in which case default behavior would be to use the window size if
 
742
<span class="target" id="index-5"></span><code class="xref std std-envvar docutils literal"><span class="pre">LINES</span></code> and <span class="target" id="index-6"></span><code class="xref std std-envvar docutils literal"><span class="pre">COLUMNS</span></code> are not set).</p>
 
743
</dd></dl>
 
744
 
 
745
<dl class="function">
 
746
<dt id="curses.use_default_colors">
 
747
<code class="descclassname">curses.</code><code class="descname">use_default_colors</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#curses.use_default_colors" title="Permalink to this definition">¶</a></dt>
 
748
<dd><p>Allow use of default values for colors on terminals supporting this feature. Use
 
749
this to support transparency in your application.  The default color is assigned
 
750
to the color number -1. After calling this function,  <code class="docutils literal"><span class="pre">init_pair(x,</span>
 
751
<span class="pre">curses.COLOR_RED,</span> <span class="pre">-1)</span></code> initializes, for instance, color pair <em>x</em> to a red
 
752
foreground color on the default background.</p>
 
753
</dd></dl>
 
754
 
 
755
<dl class="function">
 
756
<dt id="curses.wrapper">
 
757
<code class="descclassname">curses.</code><code class="descname">wrapper</code><span class="sig-paren">(</span><em>func</em>, <em>...</em><span class="sig-paren">)</span><a class="headerlink" href="#curses.wrapper" title="Permalink to this definition">¶</a></dt>
 
758
<dd><p>Initialize curses and call another callable object, <em>func</em>, which should be the
 
759
rest of your curses-using application.  If the application raises an exception,
 
760
this function will restore the terminal to a sane state before re-raising the
 
761
exception and generating a traceback.  The callable object <em>func</em> is then passed
 
762
the main window &#8216;stdscr&#8217; as its first argument, followed by any other arguments
 
763
passed to <a class="reference internal" href="#curses.wrapper" title="curses.wrapper"><code class="xref py py-func docutils literal"><span class="pre">wrapper()</span></code></a>.  Before calling <em>func</em>, <a class="reference internal" href="#curses.wrapper" title="curses.wrapper"><code class="xref py py-func docutils literal"><span class="pre">wrapper()</span></code></a> turns on
 
764
cbreak mode, turns off echo, enables the terminal keypad, and initializes colors
 
765
if the terminal has color support.  On exit (whether normally or by exception)
 
766
it restores cooked mode, turns on echo, and disables the terminal keypad.</p>
 
767
</dd></dl>
 
768
 
 
769
</div>
 
770
<div class="section" id="window-objects">
 
771
<span id="curses-window-objects"></span><h2>15.11.2. Window Objects<a class="headerlink" href="#window-objects" title="Permalink to this headline">¶</a></h2>
 
772
<p>Window objects, as returned by <a class="reference internal" href="#curses.initscr" title="curses.initscr"><code class="xref py py-func docutils literal"><span class="pre">initscr()</span></code></a> and <a class="reference internal" href="#curses.newwin" title="curses.newwin"><code class="xref py py-func docutils literal"><span class="pre">newwin()</span></code></a> above, have
 
773
the following methods:</p>
 
774
<dl class="method">
 
775
<dt id="curses.window.addch">
 
776
<code class="descclassname">window.</code><code class="descname">addch</code><span class="sig-paren">(</span><em>ch</em><span class="optional">[</span>, <em>attr</em><span class="optional">]</span><span class="sig-paren">)</span><a class="headerlink" href="#curses.window.addch" title="Permalink to this definition">¶</a></dt>
 
777
<dt>
 
778
<code class="descclassname">window.</code><code class="descname">addch</code><span class="sig-paren">(</span><em>y</em>, <em>x</em>, <em>ch</em><span class="optional">[</span>, <em>attr</em><span class="optional">]</span><span class="sig-paren">)</span></dt>
 
779
<dd><div class="admonition note">
 
780
<p class="first admonition-title">Note</p>
 
781
<p class="last">A <em>character</em> means a C character (an ASCII code), rather than a Python
 
782
character (a string of length 1). (This note is true whenever the
 
783
documentation mentions a character.) The built-in <a class="reference internal" href="functions.html#ord" title="ord"><code class="xref py py-func docutils literal"><span class="pre">ord()</span></code></a> is handy for
 
784
conveying strings to codes.</p>
 
785
</div>
 
786
<p>Paint character <em>ch</em> at <code class="docutils literal"><span class="pre">(y,</span> <span class="pre">x)</span></code> with attributes <em>attr</em>, overwriting any
 
787
character previously painter at that location.  By default, the character
 
788
position and attributes are the current settings for the window object.</p>
 
789
</dd></dl>
 
790
 
 
791
<dl class="method">
 
792
<dt id="curses.window.addnstr">
 
793
<code class="descclassname">window.</code><code class="descname">addnstr</code><span class="sig-paren">(</span><em>str</em>, <em>n</em><span class="optional">[</span>, <em>attr</em><span class="optional">]</span><span class="sig-paren">)</span><a class="headerlink" href="#curses.window.addnstr" title="Permalink to this definition">¶</a></dt>
 
794
<dt>
 
795
<code class="descclassname">window.</code><code class="descname">addnstr</code><span class="sig-paren">(</span><em>y</em>, <em>x</em>, <em>str</em>, <em>n</em><span class="optional">[</span>, <em>attr</em><span class="optional">]</span><span class="sig-paren">)</span></dt>
 
796
<dd><p>Paint at most <em>n</em> characters of the  string <em>str</em> at <code class="docutils literal"><span class="pre">(y,</span> <span class="pre">x)</span></code> with attributes
 
797
<em>attr</em>, overwriting anything previously on the display.</p>
 
798
</dd></dl>
 
799
 
 
800
<dl class="method">
 
801
<dt id="curses.window.addstr">
 
802
<code class="descclassname">window.</code><code class="descname">addstr</code><span class="sig-paren">(</span><em>str</em><span class="optional">[</span>, <em>attr</em><span class="optional">]</span><span class="sig-paren">)</span><a class="headerlink" href="#curses.window.addstr" title="Permalink to this definition">¶</a></dt>
 
803
<dt>
 
804
<code class="descclassname">window.</code><code class="descname">addstr</code><span class="sig-paren">(</span><em>y</em>, <em>x</em>, <em>str</em><span class="optional">[</span>, <em>attr</em><span class="optional">]</span><span class="sig-paren">)</span></dt>
 
805
<dd><p>Paint the string <em>str</em> at <code class="docutils literal"><span class="pre">(y,</span> <span class="pre">x)</span></code> with attributes <em>attr</em>, overwriting
 
806
anything previously on the display.</p>
 
807
</dd></dl>
 
808
 
 
809
<dl class="method">
 
810
<dt id="curses.window.attroff">
 
811
<code class="descclassname">window.</code><code class="descname">attroff</code><span class="sig-paren">(</span><em>attr</em><span class="sig-paren">)</span><a class="headerlink" href="#curses.window.attroff" title="Permalink to this definition">¶</a></dt>
 
812
<dd><p>Remove attribute <em>attr</em> from the &#8220;background&#8221; set applied to all writes to the
 
813
current window.</p>
 
814
</dd></dl>
 
815
 
 
816
<dl class="method">
 
817
<dt id="curses.window.attron">
 
818
<code class="descclassname">window.</code><code class="descname">attron</code><span class="sig-paren">(</span><em>attr</em><span class="sig-paren">)</span><a class="headerlink" href="#curses.window.attron" title="Permalink to this definition">¶</a></dt>
 
819
<dd><p>Add attribute <em>attr</em> from the &#8220;background&#8221; set applied to all writes to the
 
820
current window.</p>
 
821
</dd></dl>
 
822
 
 
823
<dl class="method">
 
824
<dt id="curses.window.attrset">
 
825
<code class="descclassname">window.</code><code class="descname">attrset</code><span class="sig-paren">(</span><em>attr</em><span class="sig-paren">)</span><a class="headerlink" href="#curses.window.attrset" title="Permalink to this definition">¶</a></dt>
 
826
<dd><p>Set the &#8220;background&#8221; set of attributes to <em>attr</em>.  This set is initially 0 (no
 
827
attributes).</p>
 
828
</dd></dl>
 
829
 
 
830
<dl class="method">
 
831
<dt id="curses.window.bkgd">
 
832
<code class="descclassname">window.</code><code class="descname">bkgd</code><span class="sig-paren">(</span><em>ch</em><span class="optional">[</span>, <em>attr</em><span class="optional">]</span><span class="sig-paren">)</span><a class="headerlink" href="#curses.window.bkgd" title="Permalink to this definition">¶</a></dt>
 
833
<dd><p>Set the background property of the window to the character <em>ch</em>, with
 
834
attributes <em>attr</em>.  The change is then applied to every character position in
 
835
that window:</p>
 
836
<ul class="simple">
 
837
<li>The attribute of every character in the window  is changed to the new
 
838
background attribute.</li>
 
839
<li>Wherever  the  former background character appears, it is changed to the new
 
840
background character.</li>
 
841
</ul>
 
842
</dd></dl>
 
843
 
 
844
<dl class="method">
 
845
<dt id="curses.window.bkgdset">
 
846
<code class="descclassname">window.</code><code class="descname">bkgdset</code><span class="sig-paren">(</span><em>ch</em><span class="optional">[</span>, <em>attr</em><span class="optional">]</span><span class="sig-paren">)</span><a class="headerlink" href="#curses.window.bkgdset" title="Permalink to this definition">¶</a></dt>
 
847
<dd><p>Set the window&#8217;s background.  A window&#8217;s background consists of a character and
 
848
any combination of attributes.  The attribute part of the background is combined
 
849
(OR&#8217;ed) with all non-blank characters that are written into the window.  Both
 
850
the character and attribute parts of the background are combined with the blank
 
851
characters.  The background becomes a property of the character and moves with
 
852
the character through any scrolling and insert/delete line/character operations.</p>
 
853
</dd></dl>
 
854
 
 
855
<dl class="method">
 
856
<dt id="curses.window.border">
 
857
<code class="descclassname">window.</code><code class="descname">border</code><span class="sig-paren">(</span><span class="optional">[</span><em>ls</em><span class="optional">[</span>, <em>rs</em><span class="optional">[</span>, <em>ts</em><span class="optional">[</span>, <em>bs</em><span class="optional">[</span>, <em>tl</em><span class="optional">[</span>, <em>tr</em><span class="optional">[</span>, <em>bl</em><span class="optional">[</span>, <em>br</em><span class="optional">]</span><span class="optional">]</span><span class="optional">]</span><span class="optional">]</span><span class="optional">]</span><span class="optional">]</span><span class="optional">]</span><span class="optional">]</span><span class="sig-paren">)</span><a class="headerlink" href="#curses.window.border" title="Permalink to this definition">¶</a></dt>
 
858
<dd><p>Draw a border around the edges of the window. Each parameter specifies  the
 
859
character to use for a specific part of the border; see the table below for more
 
860
details.  The characters can be specified as integers or as one-character
 
861
strings.</p>
 
862
<div class="admonition note">
 
863
<p class="first admonition-title">Note</p>
 
864
<p class="last">A <code class="docutils literal"><span class="pre">0</span></code> value for any parameter will cause the default character to be used for
 
865
that parameter.  Keyword parameters can <em>not</em> be used.  The defaults are listed
 
866
in this table:</p>
 
867
</div>
 
868
<table border="1" class="docutils">
 
869
<colgroup>
 
870
<col width="20%" />
 
871
<col width="38%" />
 
872
<col width="42%" />
 
873
</colgroup>
 
874
<thead valign="bottom">
 
875
<tr class="row-odd"><th class="head">Parameter</th>
 
876
<th class="head">Description</th>
 
877
<th class="head">Default value</th>
 
878
</tr>
 
879
</thead>
 
880
<tbody valign="top">
 
881
<tr class="row-even"><td><em>ls</em></td>
 
882
<td>Left side</td>
 
883
<td><code class="xref py py-const docutils literal"><span class="pre">ACS_VLINE</span></code></td>
 
884
</tr>
 
885
<tr class="row-odd"><td><em>rs</em></td>
 
886
<td>Right side</td>
 
887
<td><code class="xref py py-const docutils literal"><span class="pre">ACS_VLINE</span></code></td>
 
888
</tr>
 
889
<tr class="row-even"><td><em>ts</em></td>
 
890
<td>Top</td>
 
891
<td><code class="xref py py-const docutils literal"><span class="pre">ACS_HLINE</span></code></td>
 
892
</tr>
 
893
<tr class="row-odd"><td><em>bs</em></td>
 
894
<td>Bottom</td>
 
895
<td><code class="xref py py-const docutils literal"><span class="pre">ACS_HLINE</span></code></td>
 
896
</tr>
 
897
<tr class="row-even"><td><em>tl</em></td>
 
898
<td>Upper-left corner</td>
 
899
<td><code class="xref py py-const docutils literal"><span class="pre">ACS_ULCORNER</span></code></td>
 
900
</tr>
 
901
<tr class="row-odd"><td><em>tr</em></td>
 
902
<td>Upper-right corner</td>
 
903
<td><code class="xref py py-const docutils literal"><span class="pre">ACS_URCORNER</span></code></td>
 
904
</tr>
 
905
<tr class="row-even"><td><em>bl</em></td>
 
906
<td>Bottom-left corner</td>
 
907
<td><code class="xref py py-const docutils literal"><span class="pre">ACS_LLCORNER</span></code></td>
 
908
</tr>
 
909
<tr class="row-odd"><td><em>br</em></td>
 
910
<td>Bottom-right corner</td>
 
911
<td><code class="xref py py-const docutils literal"><span class="pre">ACS_LRCORNER</span></code></td>
 
912
</tr>
 
913
</tbody>
 
914
</table>
 
915
</dd></dl>
 
916
 
 
917
<dl class="method">
 
918
<dt id="curses.window.box">
 
919
<code class="descclassname">window.</code><code class="descname">box</code><span class="sig-paren">(</span><span class="optional">[</span><em>vertch</em>, <em>horch</em><span class="optional">]</span><span class="sig-paren">)</span><a class="headerlink" href="#curses.window.box" title="Permalink to this definition">¶</a></dt>
 
920
<dd><p>Similar to <a class="reference internal" href="#curses.window.border" title="curses.window.border"><code class="xref py py-meth docutils literal"><span class="pre">border()</span></code></a>, but both <em>ls</em> and <em>rs</em> are <em>vertch</em> and both <em>ts</em> and
 
921
<em>bs</em> are <em>horch</em>.  The default corner characters are always used by this function.</p>
 
922
</dd></dl>
 
923
 
 
924
<dl class="method">
 
925
<dt id="curses.window.chgat">
 
926
<code class="descclassname">window.</code><code class="descname">chgat</code><span class="sig-paren">(</span><em>attr</em><span class="sig-paren">)</span><a class="headerlink" href="#curses.window.chgat" title="Permalink to this definition">¶</a></dt>
 
927
<dt>
 
928
<code class="descclassname">window.</code><code class="descname">chgat</code><span class="sig-paren">(</span><em>num</em>, <em>attr</em><span class="sig-paren">)</span></dt>
 
929
<dt>
 
930
<code class="descclassname">window.</code><code class="descname">chgat</code><span class="sig-paren">(</span><em>y</em>, <em>x</em>, <em>attr</em><span class="sig-paren">)</span></dt>
 
931
<dt>
 
932
<code class="descclassname">window.</code><code class="descname">chgat</code><span class="sig-paren">(</span><em>y</em>, <em>x</em>, <em>num</em>, <em>attr</em><span class="sig-paren">)</span></dt>
 
933
<dd><p>Set the attributes of <em>num</em> characters at the current cursor position, or at
 
934
position <code class="docutils literal"><span class="pre">(y,</span> <span class="pre">x)</span></code> if supplied. If no value of <em>num</em> is given or <em>num</em> = -1,
 
935
the attribute will  be set on all the characters to the end of the line.  This
 
936
function does not move the cursor. The changed line will be touched using the
 
937
<a class="reference internal" href="#curses.window.touchline" title="curses.window.touchline"><code class="xref py py-meth docutils literal"><span class="pre">touchline()</span></code></a> method so that the contents will be redisplayed by the next
 
938
window refresh.</p>
 
939
</dd></dl>
 
940
 
 
941
<dl class="method">
 
942
<dt id="curses.window.clear">
 
943
<code class="descclassname">window.</code><code class="descname">clear</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#curses.window.clear" title="Permalink to this definition">¶</a></dt>
 
944
<dd><p>Like <a class="reference internal" href="#curses.window.erase" title="curses.window.erase"><code class="xref py py-meth docutils literal"><span class="pre">erase()</span></code></a>, but also cause the whole window to be repainted upon next
 
945
call to <a class="reference internal" href="#curses.window.refresh" title="curses.window.refresh"><code class="xref py py-meth docutils literal"><span class="pre">refresh()</span></code></a>.</p>
 
946
</dd></dl>
 
947
 
 
948
<dl class="method">
 
949
<dt id="curses.window.clearok">
 
950
<code class="descclassname">window.</code><code class="descname">clearok</code><span class="sig-paren">(</span><em>yes</em><span class="sig-paren">)</span><a class="headerlink" href="#curses.window.clearok" title="Permalink to this definition">¶</a></dt>
 
951
<dd><p>If <em>yes</em> is 1, the next call to <a class="reference internal" href="#curses.window.refresh" title="curses.window.refresh"><code class="xref py py-meth docutils literal"><span class="pre">refresh()</span></code></a> will clear the window
 
952
completely.</p>
 
953
</dd></dl>
 
954
 
 
955
<dl class="method">
 
956
<dt id="curses.window.clrtobot">
 
957
<code class="descclassname">window.</code><code class="descname">clrtobot</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#curses.window.clrtobot" title="Permalink to this definition">¶</a></dt>
 
958
<dd><p>Erase from cursor to the end of the window: all lines below the cursor are
 
959
deleted, and then the equivalent of <a class="reference internal" href="#curses.window.clrtoeol" title="curses.window.clrtoeol"><code class="xref py py-meth docutils literal"><span class="pre">clrtoeol()</span></code></a> is performed.</p>
 
960
</dd></dl>
 
961
 
 
962
<dl class="method">
 
963
<dt id="curses.window.clrtoeol">
 
964
<code class="descclassname">window.</code><code class="descname">clrtoeol</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#curses.window.clrtoeol" title="Permalink to this definition">¶</a></dt>
 
965
<dd><p>Erase from cursor to the end of the line.</p>
 
966
</dd></dl>
 
967
 
 
968
<dl class="method">
 
969
<dt id="curses.window.cursyncup">
 
970
<code class="descclassname">window.</code><code class="descname">cursyncup</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#curses.window.cursyncup" title="Permalink to this definition">¶</a></dt>
 
971
<dd><p>Update the current cursor position of all the ancestors of the window to
 
972
reflect the current cursor position of the window.</p>
 
973
</dd></dl>
 
974
 
 
975
<dl class="method">
 
976
<dt id="curses.window.delch">
 
977
<code class="descclassname">window.</code><code class="descname">delch</code><span class="sig-paren">(</span><span class="optional">[</span><em>y</em>, <em>x</em><span class="optional">]</span><span class="sig-paren">)</span><a class="headerlink" href="#curses.window.delch" title="Permalink to this definition">¶</a></dt>
 
978
<dd><p>Delete any character at <code class="docutils literal"><span class="pre">(y,</span> <span class="pre">x)</span></code>.</p>
 
979
</dd></dl>
 
980
 
 
981
<dl class="method">
 
982
<dt id="curses.window.deleteln">
 
983
<code class="descclassname">window.</code><code class="descname">deleteln</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#curses.window.deleteln" title="Permalink to this definition">¶</a></dt>
 
984
<dd><p>Delete the line under the cursor. All following lines are moved up by one line.</p>
 
985
</dd></dl>
 
986
 
 
987
<dl class="method">
 
988
<dt id="curses.window.derwin">
 
989
<code class="descclassname">window.</code><code class="descname">derwin</code><span class="sig-paren">(</span><em>begin_y</em>, <em>begin_x</em><span class="sig-paren">)</span><a class="headerlink" href="#curses.window.derwin" title="Permalink to this definition">¶</a></dt>
 
990
<dt>
 
991
<code class="descclassname">window.</code><code class="descname">derwin</code><span class="sig-paren">(</span><em>nlines</em>, <em>ncols</em>, <em>begin_y</em>, <em>begin_x</em><span class="sig-paren">)</span></dt>
 
992
<dd><p>An abbreviation for &#8220;derive window&#8221;, <a class="reference internal" href="#curses.window.derwin" title="curses.window.derwin"><code class="xref py py-meth docutils literal"><span class="pre">derwin()</span></code></a> is the same as calling
 
993
<a class="reference internal" href="#curses.window.subwin" title="curses.window.subwin"><code class="xref py py-meth docutils literal"><span class="pre">subwin()</span></code></a>, except that <em>begin_y</em> and <em>begin_x</em> are relative to the origin
 
994
of the window, rather than relative to the entire screen.  Return a window
 
995
object for the derived window.</p>
 
996
</dd></dl>
 
997
 
 
998
<dl class="method">
 
999
<dt id="curses.window.echochar">
 
1000
<code class="descclassname">window.</code><code class="descname">echochar</code><span class="sig-paren">(</span><em>ch</em><span class="optional">[</span>, <em>attr</em><span class="optional">]</span><span class="sig-paren">)</span><a class="headerlink" href="#curses.window.echochar" title="Permalink to this definition">¶</a></dt>
 
1001
<dd><p>Add character <em>ch</em> with attribute <em>attr</em>, and immediately  call <a class="reference internal" href="#curses.window.refresh" title="curses.window.refresh"><code class="xref py py-meth docutils literal"><span class="pre">refresh()</span></code></a>
 
1002
on the window.</p>
 
1003
</dd></dl>
 
1004
 
 
1005
<dl class="method">
 
1006
<dt id="curses.window.enclose">
 
1007
<code class="descclassname">window.</code><code class="descname">enclose</code><span class="sig-paren">(</span><em>y</em>, <em>x</em><span class="sig-paren">)</span><a class="headerlink" href="#curses.window.enclose" title="Permalink to this definition">¶</a></dt>
 
1008
<dd><p>Test whether the given pair of screen-relative character-cell coordinates are
 
1009
enclosed by the given window, returning <code class="docutils literal"><span class="pre">True</span></code> or <code class="docutils literal"><span class="pre">False</span></code>.  It is useful for
 
1010
determining what subset of the screen windows enclose the location of a mouse
 
1011
event.</p>
 
1012
</dd></dl>
 
1013
 
 
1014
<dl class="method">
 
1015
<dt id="curses.window.erase">
 
1016
<code class="descclassname">window.</code><code class="descname">erase</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#curses.window.erase" title="Permalink to this definition">¶</a></dt>
 
1017
<dd><p>Clear the window.</p>
 
1018
</dd></dl>
 
1019
 
 
1020
<dl class="method">
 
1021
<dt id="curses.window.getbegyx">
 
1022
<code class="descclassname">window.</code><code class="descname">getbegyx</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#curses.window.getbegyx" title="Permalink to this definition">¶</a></dt>
 
1023
<dd><p>Return a tuple <code class="docutils literal"><span class="pre">(y,</span> <span class="pre">x)</span></code> of co-ordinates of upper-left corner.</p>
 
1024
</dd></dl>
 
1025
 
 
1026
<dl class="method">
 
1027
<dt id="curses.window.getbkgd">
 
1028
<code class="descclassname">window.</code><code class="descname">getbkgd</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#curses.window.getbkgd" title="Permalink to this definition">¶</a></dt>
 
1029
<dd><p>Return the given window&#8217;s current background character/attribute pair.</p>
 
1030
</dd></dl>
 
1031
 
 
1032
<dl class="method">
 
1033
<dt id="curses.window.getch">
 
1034
<code class="descclassname">window.</code><code class="descname">getch</code><span class="sig-paren">(</span><span class="optional">[</span><em>y</em>, <em>x</em><span class="optional">]</span><span class="sig-paren">)</span><a class="headerlink" href="#curses.window.getch" title="Permalink to this definition">¶</a></dt>
 
1035
<dd><p>Get a character. Note that the integer returned does <em>not</em> have to be in ASCII
 
1036
range: function keys, keypad keys and so on return numbers higher than 256. In
 
1037
no-delay mode, -1 is returned if there is no input, else <a class="reference internal" href="#curses.window.getch" title="curses.window.getch"><code class="xref py py-func docutils literal"><span class="pre">getch()</span></code></a> waits
 
1038
until a key is pressed.</p>
 
1039
</dd></dl>
 
1040
 
 
1041
<dl class="method">
 
1042
<dt id="curses.window.getkey">
 
1043
<code class="descclassname">window.</code><code class="descname">getkey</code><span class="sig-paren">(</span><span class="optional">[</span><em>y</em>, <em>x</em><span class="optional">]</span><span class="sig-paren">)</span><a class="headerlink" href="#curses.window.getkey" title="Permalink to this definition">¶</a></dt>
 
1044
<dd><p>Get a character, returning a string instead of an integer, as <a class="reference internal" href="#curses.window.getch" title="curses.window.getch"><code class="xref py py-meth docutils literal"><span class="pre">getch()</span></code></a>
 
1045
does. Function keys, keypad keys and so on return a multibyte string containing
 
1046
the key name.  In no-delay mode, an exception is raised if there is no input.</p>
 
1047
</dd></dl>
 
1048
 
 
1049
<dl class="method">
 
1050
<dt id="curses.window.getmaxyx">
 
1051
<code class="descclassname">window.</code><code class="descname">getmaxyx</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#curses.window.getmaxyx" title="Permalink to this definition">¶</a></dt>
 
1052
<dd><p>Return a tuple <code class="docutils literal"><span class="pre">(y,</span> <span class="pre">x)</span></code> of the height and width of the window.</p>
 
1053
</dd></dl>
 
1054
 
 
1055
<dl class="method">
 
1056
<dt id="curses.window.getparyx">
 
1057
<code class="descclassname">window.</code><code class="descname">getparyx</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#curses.window.getparyx" title="Permalink to this definition">¶</a></dt>
 
1058
<dd><p>Return the beginning coordinates of this window relative to its parent window
 
1059
into two integer variables y and x.  Return <code class="docutils literal"><span class="pre">-1,</span> <span class="pre">-1</span></code> if this window has no
 
1060
parent.</p>
 
1061
</dd></dl>
 
1062
 
 
1063
<dl class="method">
 
1064
<dt id="curses.window.getstr">
 
1065
<code class="descclassname">window.</code><code class="descname">getstr</code><span class="sig-paren">(</span><span class="optional">[</span><em>y</em>, <em>x</em><span class="optional">]</span><span class="sig-paren">)</span><a class="headerlink" href="#curses.window.getstr" title="Permalink to this definition">¶</a></dt>
 
1066
<dd><p>Read a string from the user, with primitive line editing capacity.</p>
 
1067
</dd></dl>
 
1068
 
 
1069
<dl class="method">
 
1070
<dt id="curses.window.getyx">
 
1071
<code class="descclassname">window.</code><code class="descname">getyx</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#curses.window.getyx" title="Permalink to this definition">¶</a></dt>
 
1072
<dd><p>Return a tuple <code class="docutils literal"><span class="pre">(y,</span> <span class="pre">x)</span></code> of current cursor position  relative to the window&#8217;s
 
1073
upper-left corner.</p>
 
1074
</dd></dl>
 
1075
 
 
1076
<dl class="method">
 
1077
<dt id="curses.window.hline">
 
1078
<code class="descclassname">window.</code><code class="descname">hline</code><span class="sig-paren">(</span><em>ch</em>, <em>n</em><span class="sig-paren">)</span><a class="headerlink" href="#curses.window.hline" title="Permalink to this definition">¶</a></dt>
 
1079
<dt>
 
1080
<code class="descclassname">window.</code><code class="descname">hline</code><span class="sig-paren">(</span><em>y</em>, <em>x</em>, <em>ch</em>, <em>n</em><span class="sig-paren">)</span></dt>
 
1081
<dd><p>Display a horizontal line starting at <code class="docutils literal"><span class="pre">(y,</span> <span class="pre">x)</span></code> with length <em>n</em> consisting of
 
1082
the character <em>ch</em>.</p>
 
1083
</dd></dl>
 
1084
 
 
1085
<dl class="method">
 
1086
<dt id="curses.window.idcok">
 
1087
<code class="descclassname">window.</code><code class="descname">idcok</code><span class="sig-paren">(</span><em>flag</em><span class="sig-paren">)</span><a class="headerlink" href="#curses.window.idcok" title="Permalink to this definition">¶</a></dt>
 
1088
<dd><p>If <em>flag</em> is <code class="docutils literal"><span class="pre">False</span></code>, curses no longer considers using the hardware insert/delete
 
1089
character feature of the terminal; if <em>flag</em> is <code class="docutils literal"><span class="pre">True</span></code>, use of character insertion
 
1090
and deletion is enabled.  When curses is first initialized, use of character
 
1091
insert/delete is enabled by default.</p>
 
1092
</dd></dl>
 
1093
 
 
1094
<dl class="method">
 
1095
<dt id="curses.window.idlok">
 
1096
<code class="descclassname">window.</code><code class="descname">idlok</code><span class="sig-paren">(</span><em>yes</em><span class="sig-paren">)</span><a class="headerlink" href="#curses.window.idlok" title="Permalink to this definition">¶</a></dt>
 
1097
<dd><p>If called with <em>yes</em> equal to 1, <a class="reference internal" href="#module-curses" title="curses: An interface to the curses library, providing portable terminal handling. (Unix)"><code class="xref py py-mod docutils literal"><span class="pre">curses</span></code></a> will try and use hardware line
 
1098
editing facilities. Otherwise, line insertion/deletion are disabled.</p>
 
1099
</dd></dl>
 
1100
 
 
1101
<dl class="method">
 
1102
<dt id="curses.window.immedok">
 
1103
<code class="descclassname">window.</code><code class="descname">immedok</code><span class="sig-paren">(</span><em>flag</em><span class="sig-paren">)</span><a class="headerlink" href="#curses.window.immedok" title="Permalink to this definition">¶</a></dt>
 
1104
<dd><p>If <em>flag</em> is <code class="docutils literal"><span class="pre">True</span></code>, any change in the window image automatically causes the
 
1105
window to be refreshed; you no longer have to call <a class="reference internal" href="#curses.window.refresh" title="curses.window.refresh"><code class="xref py py-meth docutils literal"><span class="pre">refresh()</span></code></a> yourself.
 
1106
However, it may degrade performance considerably, due to repeated calls to
 
1107
wrefresh.  This option is disabled by default.</p>
 
1108
</dd></dl>
 
1109
 
 
1110
<dl class="method">
 
1111
<dt id="curses.window.inch">
 
1112
<code class="descclassname">window.</code><code class="descname">inch</code><span class="sig-paren">(</span><span class="optional">[</span><em>y</em>, <em>x</em><span class="optional">]</span><span class="sig-paren">)</span><a class="headerlink" href="#curses.window.inch" title="Permalink to this definition">¶</a></dt>
 
1113
<dd><p>Return the character at the given position in the window. The bottom 8 bits are
 
1114
the character proper, and upper bits are the attributes.</p>
 
1115
</dd></dl>
 
1116
 
 
1117
<dl class="method">
 
1118
<dt id="curses.window.insch">
 
1119
<code class="descclassname">window.</code><code class="descname">insch</code><span class="sig-paren">(</span><em>ch</em><span class="optional">[</span>, <em>attr</em><span class="optional">]</span><span class="sig-paren">)</span><a class="headerlink" href="#curses.window.insch" title="Permalink to this definition">¶</a></dt>
 
1120
<dt>
 
1121
<code class="descclassname">window.</code><code class="descname">insch</code><span class="sig-paren">(</span><em>y</em>, <em>x</em>, <em>ch</em><span class="optional">[</span>, <em>attr</em><span class="optional">]</span><span class="sig-paren">)</span></dt>
 
1122
<dd><p>Paint character <em>ch</em> at <code class="docutils literal"><span class="pre">(y,</span> <span class="pre">x)</span></code> with attributes <em>attr</em>, moving the line from
 
1123
position <em>x</em> right by one character.</p>
 
1124
</dd></dl>
 
1125
 
 
1126
<dl class="method">
 
1127
<dt id="curses.window.insdelln">
 
1128
<code class="descclassname">window.</code><code class="descname">insdelln</code><span class="sig-paren">(</span><em>nlines</em><span class="sig-paren">)</span><a class="headerlink" href="#curses.window.insdelln" title="Permalink to this definition">¶</a></dt>
 
1129
<dd><p>Insert <em>nlines</em> lines into the specified window above the current line.  The
 
1130
<em>nlines</em> bottom lines are lost.  For negative <em>nlines</em>, delete <em>nlines</em> lines
 
1131
starting with the one under the cursor, and move the remaining lines up.  The
 
1132
bottom <em>nlines</em> lines are cleared.  The current cursor position remains the
 
1133
same.</p>
 
1134
</dd></dl>
 
1135
 
 
1136
<dl class="method">
 
1137
<dt id="curses.window.insertln">
 
1138
<code class="descclassname">window.</code><code class="descname">insertln</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#curses.window.insertln" title="Permalink to this definition">¶</a></dt>
 
1139
<dd><p>Insert a blank line under the cursor. All following lines are moved down by one
 
1140
line.</p>
 
1141
</dd></dl>
 
1142
 
 
1143
<dl class="method">
 
1144
<dt id="curses.window.insnstr">
 
1145
<code class="descclassname">window.</code><code class="descname">insnstr</code><span class="sig-paren">(</span><em>str</em>, <em>n</em><span class="optional">[</span>, <em>attr</em><span class="optional">]</span><span class="sig-paren">)</span><a class="headerlink" href="#curses.window.insnstr" title="Permalink to this definition">¶</a></dt>
 
1146
<dt>
 
1147
<code class="descclassname">window.</code><code class="descname">insnstr</code><span class="sig-paren">(</span><em>y</em>, <em>x</em>, <em>str</em>, <em>n</em><span class="optional">[</span>, <em>attr</em><span class="optional">]</span><span class="sig-paren">)</span></dt>
 
1148
<dd><p>Insert a character string (as many characters as will fit on the line) before
 
1149
the character under the cursor, up to <em>n</em> characters.   If <em>n</em> is zero or
 
1150
negative, the entire string is inserted. All characters to the right of the
 
1151
cursor are shifted right, with the rightmost characters on the line being lost.
 
1152
The cursor position does not change (after moving to <em>y</em>, <em>x</em>, if specified).</p>
 
1153
</dd></dl>
 
1154
 
 
1155
<dl class="method">
 
1156
<dt id="curses.window.insstr">
 
1157
<code class="descclassname">window.</code><code class="descname">insstr</code><span class="sig-paren">(</span><em>str</em><span class="optional">[</span>, <em>attr</em><span class="optional">]</span><span class="sig-paren">)</span><a class="headerlink" href="#curses.window.insstr" title="Permalink to this definition">¶</a></dt>
 
1158
<dt>
 
1159
<code class="descclassname">window.</code><code class="descname">insstr</code><span class="sig-paren">(</span><em>y</em>, <em>x</em>, <em>str</em><span class="optional">[</span>, <em>attr</em><span class="optional">]</span><span class="sig-paren">)</span></dt>
 
1160
<dd><p>Insert a character string (as many characters as will fit on the line) before
 
1161
the character under the cursor.  All characters to the right of the cursor are
 
1162
shifted right, with the rightmost characters on the line being lost.  The cursor
 
1163
position does not change (after moving to <em>y</em>, <em>x</em>, if specified).</p>
 
1164
</dd></dl>
 
1165
 
 
1166
<dl class="method">
 
1167
<dt id="curses.window.instr">
 
1168
<code class="descclassname">window.</code><code class="descname">instr</code><span class="sig-paren">(</span><span class="optional">[</span><em>n</em><span class="optional">]</span><span class="sig-paren">)</span><a class="headerlink" href="#curses.window.instr" title="Permalink to this definition">¶</a></dt>
 
1169
<dt>
 
1170
<code class="descclassname">window.</code><code class="descname">instr</code><span class="sig-paren">(</span><em>y</em>, <em>x</em><span class="optional">[</span>, <em>n</em><span class="optional">]</span><span class="sig-paren">)</span></dt>
 
1171
<dd><p>Return a string of characters, extracted from the window starting at the
 
1172
current cursor position, or at <em>y</em>, <em>x</em> if specified. Attributes are stripped
 
1173
from the characters.  If <em>n</em> is specified, <a class="reference internal" href="#curses.window.instr" title="curses.window.instr"><code class="xref py py-meth docutils literal"><span class="pre">instr()</span></code></a> returns a string
 
1174
at most <em>n</em> characters long (exclusive of the trailing NUL).</p>
 
1175
</dd></dl>
 
1176
 
 
1177
<dl class="method">
 
1178
<dt id="curses.window.is_linetouched">
 
1179
<code class="descclassname">window.</code><code class="descname">is_linetouched</code><span class="sig-paren">(</span><em>line</em><span class="sig-paren">)</span><a class="headerlink" href="#curses.window.is_linetouched" title="Permalink to this definition">¶</a></dt>
 
1180
<dd><p>Return <code class="docutils literal"><span class="pre">True</span></code> if the specified line was modified since the last call to
 
1181
<a class="reference internal" href="#curses.window.refresh" title="curses.window.refresh"><code class="xref py py-meth docutils literal"><span class="pre">refresh()</span></code></a>; otherwise return <code class="docutils literal"><span class="pre">False</span></code>.  Raise a <a class="reference internal" href="#curses.error" title="curses.error"><code class="xref py py-exc docutils literal"><span class="pre">curses.error</span></code></a>
 
1182
exception if <em>line</em> is not valid for the given window.</p>
 
1183
</dd></dl>
 
1184
 
 
1185
<dl class="method">
 
1186
<dt id="curses.window.is_wintouched">
 
1187
<code class="descclassname">window.</code><code class="descname">is_wintouched</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#curses.window.is_wintouched" title="Permalink to this definition">¶</a></dt>
 
1188
<dd><p>Return <code class="docutils literal"><span class="pre">True</span></code> if the specified window was modified since the last call to
 
1189
<a class="reference internal" href="#curses.window.refresh" title="curses.window.refresh"><code class="xref py py-meth docutils literal"><span class="pre">refresh()</span></code></a>; otherwise return <code class="docutils literal"><span class="pre">False</span></code>.</p>
 
1190
</dd></dl>
 
1191
 
 
1192
<dl class="method">
 
1193
<dt id="curses.window.keypad">
 
1194
<code class="descclassname">window.</code><code class="descname">keypad</code><span class="sig-paren">(</span><em>yes</em><span class="sig-paren">)</span><a class="headerlink" href="#curses.window.keypad" title="Permalink to this definition">¶</a></dt>
 
1195
<dd><p>If <em>yes</em> is 1, escape sequences generated by some keys (keypad,  function keys)
 
1196
will be interpreted by <a class="reference internal" href="#module-curses" title="curses: An interface to the curses library, providing portable terminal handling. (Unix)"><code class="xref py py-mod docutils literal"><span class="pre">curses</span></code></a>. If <em>yes</em> is 0, escape sequences will be
 
1197
left as is in the input stream.</p>
 
1198
</dd></dl>
 
1199
 
 
1200
<dl class="method">
 
1201
<dt id="curses.window.leaveok">
 
1202
<code class="descclassname">window.</code><code class="descname">leaveok</code><span class="sig-paren">(</span><em>yes</em><span class="sig-paren">)</span><a class="headerlink" href="#curses.window.leaveok" title="Permalink to this definition">¶</a></dt>
 
1203
<dd><p>If <em>yes</em> is 1, cursor is left where it is on update, instead of being at &#8220;cursor
 
1204
position.&#8221;  This reduces cursor movement where possible. If possible the cursor
 
1205
will be made invisible.</p>
 
1206
<p>If <em>yes</em> is 0, cursor will always be at &#8220;cursor position&#8221; after an update.</p>
 
1207
</dd></dl>
 
1208
 
 
1209
<dl class="method">
 
1210
<dt id="curses.window.move">
 
1211
<code class="descclassname">window.</code><code class="descname">move</code><span class="sig-paren">(</span><em>new_y</em>, <em>new_x</em><span class="sig-paren">)</span><a class="headerlink" href="#curses.window.move" title="Permalink to this definition">¶</a></dt>
 
1212
<dd><p>Move cursor to <code class="docutils literal"><span class="pre">(new_y,</span> <span class="pre">new_x)</span></code>.</p>
 
1213
</dd></dl>
 
1214
 
 
1215
<dl class="method">
 
1216
<dt id="curses.window.mvderwin">
 
1217
<code class="descclassname">window.</code><code class="descname">mvderwin</code><span class="sig-paren">(</span><em>y</em>, <em>x</em><span class="sig-paren">)</span><a class="headerlink" href="#curses.window.mvderwin" title="Permalink to this definition">¶</a></dt>
 
1218
<dd><p>Move the window inside its parent window.  The screen-relative parameters of
 
1219
the window are not changed.  This routine is used to display different parts of
 
1220
the parent window at the same physical position on the screen.</p>
 
1221
</dd></dl>
 
1222
 
 
1223
<dl class="method">
 
1224
<dt id="curses.window.mvwin">
 
1225
<code class="descclassname">window.</code><code class="descname">mvwin</code><span class="sig-paren">(</span><em>new_y</em>, <em>new_x</em><span class="sig-paren">)</span><a class="headerlink" href="#curses.window.mvwin" title="Permalink to this definition">¶</a></dt>
 
1226
<dd><p>Move the window so its upper-left corner is at <code class="docutils literal"><span class="pre">(new_y,</span> <span class="pre">new_x)</span></code>.</p>
 
1227
</dd></dl>
 
1228
 
 
1229
<dl class="method">
 
1230
<dt id="curses.window.nodelay">
 
1231
<code class="descclassname">window.</code><code class="descname">nodelay</code><span class="sig-paren">(</span><em>yes</em><span class="sig-paren">)</span><a class="headerlink" href="#curses.window.nodelay" title="Permalink to this definition">¶</a></dt>
 
1232
<dd><p>If <em>yes</em> is <code class="docutils literal"><span class="pre">1</span></code>, <a class="reference internal" href="#curses.window.getch" title="curses.window.getch"><code class="xref py py-meth docutils literal"><span class="pre">getch()</span></code></a> will be non-blocking.</p>
 
1233
</dd></dl>
 
1234
 
 
1235
<dl class="method">
 
1236
<dt id="curses.window.notimeout">
 
1237
<code class="descclassname">window.</code><code class="descname">notimeout</code><span class="sig-paren">(</span><em>yes</em><span class="sig-paren">)</span><a class="headerlink" href="#curses.window.notimeout" title="Permalink to this definition">¶</a></dt>
 
1238
<dd><p>If <em>yes</em> is <code class="docutils literal"><span class="pre">1</span></code>, escape sequences will not be timed out.</p>
 
1239
<p>If <em>yes</em> is <code class="docutils literal"><span class="pre">0</span></code>, after a few milliseconds, an escape sequence will not be
 
1240
interpreted, and will be left in the input stream as is.</p>
 
1241
</dd></dl>
 
1242
 
 
1243
<dl class="method">
 
1244
<dt id="curses.window.noutrefresh">
 
1245
<code class="descclassname">window.</code><code class="descname">noutrefresh</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#curses.window.noutrefresh" title="Permalink to this definition">¶</a></dt>
 
1246
<dd><p>Mark for refresh but wait.  This function updates the data structure
 
1247
representing the desired state of the window, but does not force an update of
 
1248
the physical screen.  To accomplish that, call  <a class="reference internal" href="#curses.doupdate" title="curses.doupdate"><code class="xref py py-func docutils literal"><span class="pre">doupdate()</span></code></a>.</p>
 
1249
</dd></dl>
 
1250
 
 
1251
<dl class="method">
 
1252
<dt id="curses.window.overlay">
 
1253
<code class="descclassname">window.</code><code class="descname">overlay</code><span class="sig-paren">(</span><em>destwin</em><span class="optional">[</span>, <em>sminrow</em>, <em>smincol</em>, <em>dminrow</em>, <em>dmincol</em>, <em>dmaxrow</em>, <em>dmaxcol</em><span class="optional">]</span><span class="sig-paren">)</span><a class="headerlink" href="#curses.window.overlay" title="Permalink to this definition">¶</a></dt>
 
1254
<dd><p>Overlay the window on top of <em>destwin</em>. The windows need not be the same size,
 
1255
only the overlapping region is copied. This copy is non-destructive, which means
 
1256
that the current background character does not overwrite the old contents of
 
1257
<em>destwin</em>.</p>
 
1258
<p>To get fine-grained control over the copied region, the second form of
 
1259
<a class="reference internal" href="#curses.window.overlay" title="curses.window.overlay"><code class="xref py py-meth docutils literal"><span class="pre">overlay()</span></code></a> can be used. <em>sminrow</em> and <em>smincol</em> are the upper-left
 
1260
coordinates of the source window, and the other variables mark a rectangle in
 
1261
the destination window.</p>
 
1262
</dd></dl>
 
1263
 
 
1264
<dl class="method">
 
1265
<dt id="curses.window.overwrite">
 
1266
<code class="descclassname">window.</code><code class="descname">overwrite</code><span class="sig-paren">(</span><em>destwin</em><span class="optional">[</span>, <em>sminrow</em>, <em>smincol</em>, <em>dminrow</em>, <em>dmincol</em>, <em>dmaxrow</em>, <em>dmaxcol</em><span class="optional">]</span><span class="sig-paren">)</span><a class="headerlink" href="#curses.window.overwrite" title="Permalink to this definition">¶</a></dt>
 
1267
<dd><p>Overwrite the window on top of <em>destwin</em>. The windows need not be the same size,
 
1268
in which case only the overlapping region is copied. This copy is destructive,
 
1269
which means that the current background character overwrites the old contents of
 
1270
<em>destwin</em>.</p>
 
1271
<p>To get fine-grained control over the copied region, the second form of
 
1272
<a class="reference internal" href="#curses.window.overwrite" title="curses.window.overwrite"><code class="xref py py-meth docutils literal"><span class="pre">overwrite()</span></code></a> can be used. <em>sminrow</em> and <em>smincol</em> are the upper-left
 
1273
coordinates of the source window, the other variables mark a rectangle in the
 
1274
destination window.</p>
 
1275
</dd></dl>
 
1276
 
 
1277
<dl class="method">
 
1278
<dt id="curses.window.putwin">
 
1279
<code class="descclassname">window.</code><code class="descname">putwin</code><span class="sig-paren">(</span><em>file</em><span class="sig-paren">)</span><a class="headerlink" href="#curses.window.putwin" title="Permalink to this definition">¶</a></dt>
 
1280
<dd><p>Write all data associated with the window into the provided file object.  This
 
1281
information can be later retrieved using the <a class="reference internal" href="#curses.getwin" title="curses.getwin"><code class="xref py py-func docutils literal"><span class="pre">getwin()</span></code></a> function.</p>
 
1282
</dd></dl>
 
1283
 
 
1284
<dl class="method">
 
1285
<dt id="curses.window.redrawln">
 
1286
<code class="descclassname">window.</code><code class="descname">redrawln</code><span class="sig-paren">(</span><em>beg</em>, <em>num</em><span class="sig-paren">)</span><a class="headerlink" href="#curses.window.redrawln" title="Permalink to this definition">¶</a></dt>
 
1287
<dd><p>Indicate that the <em>num</em> screen lines, starting at line <em>beg</em>, are corrupted and
 
1288
should be completely redrawn on the next <a class="reference internal" href="#curses.window.refresh" title="curses.window.refresh"><code class="xref py py-meth docutils literal"><span class="pre">refresh()</span></code></a> call.</p>
 
1289
</dd></dl>
 
1290
 
 
1291
<dl class="method">
 
1292
<dt id="curses.window.redrawwin">
 
1293
<code class="descclassname">window.</code><code class="descname">redrawwin</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#curses.window.redrawwin" title="Permalink to this definition">¶</a></dt>
 
1294
<dd><p>Touch the entire window, causing it to be completely redrawn on the next
 
1295
<a class="reference internal" href="#curses.window.refresh" title="curses.window.refresh"><code class="xref py py-meth docutils literal"><span class="pre">refresh()</span></code></a> call.</p>
 
1296
</dd></dl>
 
1297
 
 
1298
<dl class="method">
 
1299
<dt id="curses.window.refresh">
 
1300
<code class="descclassname">window.</code><code class="descname">refresh</code><span class="sig-paren">(</span><span class="optional">[</span><em>pminrow</em>, <em>pmincol</em>, <em>sminrow</em>, <em>smincol</em>, <em>smaxrow</em>, <em>smaxcol</em><span class="optional">]</span><span class="sig-paren">)</span><a class="headerlink" href="#curses.window.refresh" title="Permalink to this definition">¶</a></dt>
 
1301
<dd><p>Update the display immediately (sync actual screen with previous
 
1302
drawing/deleting methods).</p>
 
1303
<p>The 6 optional arguments can only be specified when the window is a pad created
 
1304
with <a class="reference internal" href="#curses.newpad" title="curses.newpad"><code class="xref py py-func docutils literal"><span class="pre">newpad()</span></code></a>.  The additional parameters are needed to indicate what part
 
1305
of the pad and screen are involved. <em>pminrow</em> and <em>pmincol</em> specify the upper
 
1306
left-hand corner of the rectangle to be displayed in the pad.  <em>sminrow</em>,
 
1307
<em>smincol</em>, <em>smaxrow</em>, and <em>smaxcol</em> specify the edges of the rectangle to be
 
1308
displayed on the screen.  The lower right-hand corner of the rectangle to be
 
1309
displayed in the pad is calculated from the screen coordinates, since the
 
1310
rectangles must be the same size.  Both rectangles must be entirely contained
 
1311
within their respective structures.  Negative values of <em>pminrow</em>, <em>pmincol</em>,
 
1312
<em>sminrow</em>, or <em>smincol</em> are treated as if they were zero.</p>
 
1313
</dd></dl>
 
1314
 
 
1315
<dl class="method">
 
1316
<dt id="curses.window.resize">
 
1317
<code class="descclassname">window.</code><code class="descname">resize</code><span class="sig-paren">(</span><em>nlines</em>, <em>ncols</em><span class="sig-paren">)</span><a class="headerlink" href="#curses.window.resize" title="Permalink to this definition">¶</a></dt>
 
1318
<dd><p>Reallocate storage for a curses window to adjust its dimensions to the
 
1319
specified values.  If either dimension is larger than the current values, the
 
1320
window&#8217;s data is filled with blanks that have the current background
 
1321
rendition (as set by <a class="reference internal" href="#curses.window.bkgdset" title="curses.window.bkgdset"><code class="xref py py-meth docutils literal"><span class="pre">bkgdset()</span></code></a>) merged into them.</p>
 
1322
</dd></dl>
 
1323
 
 
1324
<dl class="method">
 
1325
<dt id="curses.window.scroll">
 
1326
<code class="descclassname">window.</code><code class="descname">scroll</code><span class="sig-paren">(</span><span class="optional">[</span><em>lines=1</em><span class="optional">]</span><span class="sig-paren">)</span><a class="headerlink" href="#curses.window.scroll" title="Permalink to this definition">¶</a></dt>
 
1327
<dd><p>Scroll the screen or scrolling region upward by <em>lines</em> lines.</p>
 
1328
</dd></dl>
 
1329
 
 
1330
<dl class="method">
 
1331
<dt id="curses.window.scrollok">
 
1332
<code class="descclassname">window.</code><code class="descname">scrollok</code><span class="sig-paren">(</span><em>flag</em><span class="sig-paren">)</span><a class="headerlink" href="#curses.window.scrollok" title="Permalink to this definition">¶</a></dt>
 
1333
<dd><p>Control what happens when the cursor of a window is moved off the edge of the
 
1334
window or scrolling region, either as a result of a newline action on the bottom
 
1335
line, or typing the last character of the last line.  If <em>flag</em> is false, the
 
1336
cursor is left on the bottom line.  If <em>flag</em> is true, the window is scrolled up
 
1337
one line.  Note that in order to get the physical scrolling effect on the
 
1338
terminal, it is also necessary to call <a class="reference internal" href="#curses.window.idlok" title="curses.window.idlok"><code class="xref py py-meth docutils literal"><span class="pre">idlok()</span></code></a>.</p>
 
1339
</dd></dl>
 
1340
 
 
1341
<dl class="method">
 
1342
<dt id="curses.window.setscrreg">
 
1343
<code class="descclassname">window.</code><code class="descname">setscrreg</code><span class="sig-paren">(</span><em>top</em>, <em>bottom</em><span class="sig-paren">)</span><a class="headerlink" href="#curses.window.setscrreg" title="Permalink to this definition">¶</a></dt>
 
1344
<dd><p>Set the scrolling region from line <em>top</em> to line <em>bottom</em>. All scrolling actions
 
1345
will take place in this region.</p>
 
1346
</dd></dl>
 
1347
 
 
1348
<dl class="method">
 
1349
<dt id="curses.window.standend">
 
1350
<code class="descclassname">window.</code><code class="descname">standend</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#curses.window.standend" title="Permalink to this definition">¶</a></dt>
 
1351
<dd><p>Turn off the standout attribute.  On some terminals this has the side effect of
 
1352
turning off all attributes.</p>
 
1353
</dd></dl>
 
1354
 
 
1355
<dl class="method">
 
1356
<dt id="curses.window.standout">
 
1357
<code class="descclassname">window.</code><code class="descname">standout</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#curses.window.standout" title="Permalink to this definition">¶</a></dt>
 
1358
<dd><p>Turn on attribute <em>A_STANDOUT</em>.</p>
 
1359
</dd></dl>
 
1360
 
 
1361
<dl class="method">
 
1362
<dt id="curses.window.subpad">
 
1363
<code class="descclassname">window.</code><code class="descname">subpad</code><span class="sig-paren">(</span><em>begin_y</em>, <em>begin_x</em><span class="sig-paren">)</span><a class="headerlink" href="#curses.window.subpad" title="Permalink to this definition">¶</a></dt>
 
1364
<dt>
 
1365
<code class="descclassname">window.</code><code class="descname">subpad</code><span class="sig-paren">(</span><em>nlines</em>, <em>ncols</em>, <em>begin_y</em>, <em>begin_x</em><span class="sig-paren">)</span></dt>
 
1366
<dd><p>Return a sub-window, whose upper-left corner is at <code class="docutils literal"><span class="pre">(begin_y,</span> <span class="pre">begin_x)</span></code>, and
 
1367
whose width/height is <em>ncols</em>/<em>nlines</em>.</p>
 
1368
</dd></dl>
 
1369
 
 
1370
<dl class="method">
 
1371
<dt id="curses.window.subwin">
 
1372
<code class="descclassname">window.</code><code class="descname">subwin</code><span class="sig-paren">(</span><em>begin_y</em>, <em>begin_x</em><span class="sig-paren">)</span><a class="headerlink" href="#curses.window.subwin" title="Permalink to this definition">¶</a></dt>
 
1373
<dt>
 
1374
<code class="descclassname">window.</code><code class="descname">subwin</code><span class="sig-paren">(</span><em>nlines</em>, <em>ncols</em>, <em>begin_y</em>, <em>begin_x</em><span class="sig-paren">)</span></dt>
 
1375
<dd><p>Return a sub-window, whose upper-left corner is at <code class="docutils literal"><span class="pre">(begin_y,</span> <span class="pre">begin_x)</span></code>, and
 
1376
whose width/height is <em>ncols</em>/<em>nlines</em>.</p>
 
1377
<p>By default, the sub-window will extend from the specified position to the lower
 
1378
right corner of the window.</p>
 
1379
</dd></dl>
 
1380
 
 
1381
<dl class="method">
 
1382
<dt id="curses.window.syncdown">
 
1383
<code class="descclassname">window.</code><code class="descname">syncdown</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#curses.window.syncdown" title="Permalink to this definition">¶</a></dt>
 
1384
<dd><p>Touch each location in the window that has been touched in any of its ancestor
 
1385
windows.  This routine is called by <a class="reference internal" href="#curses.window.refresh" title="curses.window.refresh"><code class="xref py py-meth docutils literal"><span class="pre">refresh()</span></code></a>, so it should almost never
 
1386
be necessary to call it manually.</p>
 
1387
</dd></dl>
 
1388
 
 
1389
<dl class="method">
 
1390
<dt id="curses.window.syncok">
 
1391
<code class="descclassname">window.</code><code class="descname">syncok</code><span class="sig-paren">(</span><em>flag</em><span class="sig-paren">)</span><a class="headerlink" href="#curses.window.syncok" title="Permalink to this definition">¶</a></dt>
 
1392
<dd><p>If called with <em>flag</em> set to <code class="docutils literal"><span class="pre">True</span></code>, then <a class="reference internal" href="#curses.window.syncup" title="curses.window.syncup"><code class="xref py py-meth docutils literal"><span class="pre">syncup()</span></code></a> is called automatically
 
1393
whenever there is a change in the window.</p>
 
1394
</dd></dl>
 
1395
 
 
1396
<dl class="method">
 
1397
<dt id="curses.window.syncup">
 
1398
<code class="descclassname">window.</code><code class="descname">syncup</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#curses.window.syncup" title="Permalink to this definition">¶</a></dt>
 
1399
<dd><p>Touch all locations in ancestors of the window that have been changed in  the
 
1400
window.</p>
 
1401
</dd></dl>
 
1402
 
 
1403
<dl class="method">
 
1404
<dt id="curses.window.timeout">
 
1405
<code class="descclassname">window.</code><code class="descname">timeout</code><span class="sig-paren">(</span><em>delay</em><span class="sig-paren">)</span><a class="headerlink" href="#curses.window.timeout" title="Permalink to this definition">¶</a></dt>
 
1406
<dd><p>Set blocking or non-blocking read behavior for the window.  If <em>delay</em> is
 
1407
negative, blocking read is used (which will wait indefinitely for input).  If
 
1408
<em>delay</em> is zero, then non-blocking read is used, and -1 will be returned by
 
1409
<a class="reference internal" href="#curses.window.getch" title="curses.window.getch"><code class="xref py py-meth docutils literal"><span class="pre">getch()</span></code></a> if no input is waiting.  If <em>delay</em> is positive, then
 
1410
<a class="reference internal" href="#curses.window.getch" title="curses.window.getch"><code class="xref py py-meth docutils literal"><span class="pre">getch()</span></code></a> will block for <em>delay</em> milliseconds, and return -1 if there is
 
1411
still no input at the end of that time.</p>
 
1412
</dd></dl>
 
1413
 
 
1414
<dl class="method">
 
1415
<dt id="curses.window.touchline">
 
1416
<code class="descclassname">window.</code><code class="descname">touchline</code><span class="sig-paren">(</span><em>start</em>, <em>count</em><span class="optional">[</span>, <em>changed</em><span class="optional">]</span><span class="sig-paren">)</span><a class="headerlink" href="#curses.window.touchline" title="Permalink to this definition">¶</a></dt>
 
1417
<dd><p>Pretend <em>count</em> lines have been changed, starting with line <em>start</em>.  If
 
1418
<em>changed</em> is supplied, it specifies whether the affected lines are marked as
 
1419
having been changed (<em>changed</em>=1) or unchanged (<em>changed</em>=0).</p>
 
1420
</dd></dl>
 
1421
 
 
1422
<dl class="method">
 
1423
<dt id="curses.window.touchwin">
 
1424
<code class="descclassname">window.</code><code class="descname">touchwin</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#curses.window.touchwin" title="Permalink to this definition">¶</a></dt>
 
1425
<dd><p>Pretend the whole window has been changed, for purposes of drawing
 
1426
optimizations.</p>
 
1427
</dd></dl>
 
1428
 
 
1429
<dl class="method">
 
1430
<dt id="curses.window.untouchwin">
 
1431
<code class="descclassname">window.</code><code class="descname">untouchwin</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#curses.window.untouchwin" title="Permalink to this definition">¶</a></dt>
 
1432
<dd><p>Mark all lines in  the  window  as unchanged since the last call to
 
1433
<a class="reference internal" href="#curses.window.refresh" title="curses.window.refresh"><code class="xref py py-meth docutils literal"><span class="pre">refresh()</span></code></a>.</p>
 
1434
</dd></dl>
 
1435
 
 
1436
<dl class="method">
 
1437
<dt id="curses.window.vline">
 
1438
<code class="descclassname">window.</code><code class="descname">vline</code><span class="sig-paren">(</span><em>ch</em>, <em>n</em><span class="sig-paren">)</span><a class="headerlink" href="#curses.window.vline" title="Permalink to this definition">¶</a></dt>
 
1439
<dt>
 
1440
<code class="descclassname">window.</code><code class="descname">vline</code><span class="sig-paren">(</span><em>y</em>, <em>x</em>, <em>ch</em>, <em>n</em><span class="sig-paren">)</span></dt>
 
1441
<dd><p>Display a vertical line starting at <code class="docutils literal"><span class="pre">(y,</span> <span class="pre">x)</span></code> with length <em>n</em> consisting of the
 
1442
character <em>ch</em>.</p>
 
1443
</dd></dl>
 
1444
 
 
1445
</div>
 
1446
<div class="section" id="constants">
 
1447
<h2>15.11.3. Constants<a class="headerlink" href="#constants" title="Permalink to this headline">¶</a></h2>
 
1448
<p>The <a class="reference internal" href="#module-curses" title="curses: An interface to the curses library, providing portable terminal handling. (Unix)"><code class="xref py py-mod docutils literal"><span class="pre">curses</span></code></a> module defines the following data members:</p>
 
1449
<dl class="data">
 
1450
<dt id="curses.ERR">
 
1451
<code class="descclassname">curses.</code><code class="descname">ERR</code><a class="headerlink" href="#curses.ERR" title="Permalink to this definition">¶</a></dt>
 
1452
<dd><p>Some curses routines  that  return  an integer, such as  <code class="xref py py-func docutils literal"><span class="pre">getch()</span></code>, return
 
1453
<a class="reference internal" href="#curses.ERR" title="curses.ERR"><code class="xref py py-const docutils literal"><span class="pre">ERR</span></code></a> upon failure.</p>
 
1454
</dd></dl>
 
1455
 
 
1456
<dl class="data">
 
1457
<dt id="curses.OK">
 
1458
<code class="descclassname">curses.</code><code class="descname">OK</code><a class="headerlink" href="#curses.OK" title="Permalink to this definition">¶</a></dt>
 
1459
<dd><p>Some curses routines  that  return  an integer, such as  <a class="reference internal" href="#curses.napms" title="curses.napms"><code class="xref py py-func docutils literal"><span class="pre">napms()</span></code></a>, return
 
1460
<a class="reference internal" href="#curses.OK" title="curses.OK"><code class="xref py py-const docutils literal"><span class="pre">OK</span></code></a> upon success.</p>
 
1461
</dd></dl>
 
1462
 
 
1463
<dl class="data">
 
1464
<dt id="curses.version">
 
1465
<code class="descclassname">curses.</code><code class="descname">version</code><a class="headerlink" href="#curses.version" title="Permalink to this definition">¶</a></dt>
 
1466
<dd><p>A string representing the current version of the module.  Also available as
 
1467
<code class="xref py py-const docutils literal"><span class="pre">__version__</span></code>.</p>
 
1468
</dd></dl>
 
1469
 
 
1470
<p>Several constants are available to specify character cell attributes:</p>
 
1471
<table border="1" class="docutils">
 
1472
<colgroup>
 
1473
<col width="37%" />
 
1474
<col width="63%" />
 
1475
</colgroup>
 
1476
<thead valign="bottom">
 
1477
<tr class="row-odd"><th class="head">Attribute</th>
 
1478
<th class="head">Meaning</th>
 
1479
</tr>
 
1480
</thead>
 
1481
<tbody valign="top">
 
1482
<tr class="row-even"><td><code class="docutils literal"><span class="pre">A_ALTCHARSET</span></code></td>
 
1483
<td>Alternate character set mode.</td>
 
1484
</tr>
 
1485
<tr class="row-odd"><td><code class="docutils literal"><span class="pre">A_BLINK</span></code></td>
 
1486
<td>Blink mode.</td>
 
1487
</tr>
 
1488
<tr class="row-even"><td><code class="docutils literal"><span class="pre">A_BOLD</span></code></td>
 
1489
<td>Bold mode.</td>
 
1490
</tr>
 
1491
<tr class="row-odd"><td><code class="docutils literal"><span class="pre">A_DIM</span></code></td>
 
1492
<td>Dim mode.</td>
 
1493
</tr>
 
1494
<tr class="row-even"><td><code class="docutils literal"><span class="pre">A_NORMAL</span></code></td>
 
1495
<td>Normal attribute.</td>
 
1496
</tr>
 
1497
<tr class="row-odd"><td><code class="docutils literal"><span class="pre">A_REVERSE</span></code></td>
 
1498
<td>Reverse background and
 
1499
foreground colors.</td>
 
1500
</tr>
 
1501
<tr class="row-even"><td><code class="docutils literal"><span class="pre">A_STANDOUT</span></code></td>
 
1502
<td>Standout mode.</td>
 
1503
</tr>
 
1504
<tr class="row-odd"><td><code class="docutils literal"><span class="pre">A_UNDERLINE</span></code></td>
 
1505
<td>Underline mode.</td>
 
1506
</tr>
 
1507
</tbody>
 
1508
</table>
 
1509
<p>Keys are referred to by integer constants with names starting with  <code class="docutils literal"><span class="pre">KEY_</span></code>.
 
1510
The exact keycaps available are system dependent.</p>
 
1511
<table border="1" class="docutils">
 
1512
<colgroup>
 
1513
<col width="30%" />
 
1514
<col width="70%" />
 
1515
</colgroup>
 
1516
<thead valign="bottom">
 
1517
<tr class="row-odd"><th class="head">Key constant</th>
 
1518
<th class="head">Key</th>
 
1519
</tr>
 
1520
</thead>
 
1521
<tbody valign="top">
 
1522
<tr class="row-even"><td><code class="docutils literal"><span class="pre">KEY_MIN</span></code></td>
 
1523
<td>Minimum key value</td>
 
1524
</tr>
 
1525
<tr class="row-odd"><td><code class="docutils literal"><span class="pre">KEY_BREAK</span></code></td>
 
1526
<td>Break key (unreliable)</td>
 
1527
</tr>
 
1528
<tr class="row-even"><td><code class="docutils literal"><span class="pre">KEY_DOWN</span></code></td>
 
1529
<td>Down-arrow</td>
 
1530
</tr>
 
1531
<tr class="row-odd"><td><code class="docutils literal"><span class="pre">KEY_UP</span></code></td>
 
1532
<td>Up-arrow</td>
 
1533
</tr>
 
1534
<tr class="row-even"><td><code class="docutils literal"><span class="pre">KEY_LEFT</span></code></td>
 
1535
<td>Left-arrow</td>
 
1536
</tr>
 
1537
<tr class="row-odd"><td><code class="docutils literal"><span class="pre">KEY_RIGHT</span></code></td>
 
1538
<td>Right-arrow</td>
 
1539
</tr>
 
1540
<tr class="row-even"><td><code class="docutils literal"><span class="pre">KEY_HOME</span></code></td>
 
1541
<td>Home key (upward+left arrow)</td>
 
1542
</tr>
 
1543
<tr class="row-odd"><td><code class="docutils literal"><span class="pre">KEY_BACKSPACE</span></code></td>
 
1544
<td>Backspace (unreliable)</td>
 
1545
</tr>
 
1546
<tr class="row-even"><td><code class="docutils literal"><span class="pre">KEY_F0</span></code></td>
 
1547
<td>Function keys.  Up to 64 function keys are
 
1548
supported.</td>
 
1549
</tr>
 
1550
<tr class="row-odd"><td><code class="docutils literal"><span class="pre">KEY_Fn</span></code></td>
 
1551
<td>Value of function key <em>n</em></td>
 
1552
</tr>
 
1553
<tr class="row-even"><td><code class="docutils literal"><span class="pre">KEY_DL</span></code></td>
 
1554
<td>Delete line</td>
 
1555
</tr>
 
1556
<tr class="row-odd"><td><code class="docutils literal"><span class="pre">KEY_IL</span></code></td>
 
1557
<td>Insert line</td>
 
1558
</tr>
 
1559
<tr class="row-even"><td><code class="docutils literal"><span class="pre">KEY_DC</span></code></td>
 
1560
<td>Delete character</td>
 
1561
</tr>
 
1562
<tr class="row-odd"><td><code class="docutils literal"><span class="pre">KEY_IC</span></code></td>
 
1563
<td>Insert char or enter insert mode</td>
 
1564
</tr>
 
1565
<tr class="row-even"><td><code class="docutils literal"><span class="pre">KEY_EIC</span></code></td>
 
1566
<td>Exit insert char mode</td>
 
1567
</tr>
 
1568
<tr class="row-odd"><td><code class="docutils literal"><span class="pre">KEY_CLEAR</span></code></td>
 
1569
<td>Clear screen</td>
 
1570
</tr>
 
1571
<tr class="row-even"><td><code class="docutils literal"><span class="pre">KEY_EOS</span></code></td>
 
1572
<td>Clear to end of screen</td>
 
1573
</tr>
 
1574
<tr class="row-odd"><td><code class="docutils literal"><span class="pre">KEY_EOL</span></code></td>
 
1575
<td>Clear to end of line</td>
 
1576
</tr>
 
1577
<tr class="row-even"><td><code class="docutils literal"><span class="pre">KEY_SF</span></code></td>
 
1578
<td>Scroll 1 line forward</td>
 
1579
</tr>
 
1580
<tr class="row-odd"><td><code class="docutils literal"><span class="pre">KEY_SR</span></code></td>
 
1581
<td>Scroll 1 line backward (reverse)</td>
 
1582
</tr>
 
1583
<tr class="row-even"><td><code class="docutils literal"><span class="pre">KEY_NPAGE</span></code></td>
 
1584
<td>Next page</td>
 
1585
</tr>
 
1586
<tr class="row-odd"><td><code class="docutils literal"><span class="pre">KEY_PPAGE</span></code></td>
 
1587
<td>Previous page</td>
 
1588
</tr>
 
1589
<tr class="row-even"><td><code class="docutils literal"><span class="pre">KEY_STAB</span></code></td>
 
1590
<td>Set tab</td>
 
1591
</tr>
 
1592
<tr class="row-odd"><td><code class="docutils literal"><span class="pre">KEY_CTAB</span></code></td>
 
1593
<td>Clear tab</td>
 
1594
</tr>
 
1595
<tr class="row-even"><td><code class="docutils literal"><span class="pre">KEY_CATAB</span></code></td>
 
1596
<td>Clear all tabs</td>
 
1597
</tr>
 
1598
<tr class="row-odd"><td><code class="docutils literal"><span class="pre">KEY_ENTER</span></code></td>
 
1599
<td>Enter or send (unreliable)</td>
 
1600
</tr>
 
1601
<tr class="row-even"><td><code class="docutils literal"><span class="pre">KEY_SRESET</span></code></td>
 
1602
<td>Soft (partial) reset (unreliable)</td>
 
1603
</tr>
 
1604
<tr class="row-odd"><td><code class="docutils literal"><span class="pre">KEY_RESET</span></code></td>
 
1605
<td>Reset or hard reset (unreliable)</td>
 
1606
</tr>
 
1607
<tr class="row-even"><td><code class="docutils literal"><span class="pre">KEY_PRINT</span></code></td>
 
1608
<td>Print</td>
 
1609
</tr>
 
1610
<tr class="row-odd"><td><code class="docutils literal"><span class="pre">KEY_LL</span></code></td>
 
1611
<td>Home down or bottom (lower left)</td>
 
1612
</tr>
 
1613
<tr class="row-even"><td><code class="docutils literal"><span class="pre">KEY_A1</span></code></td>
 
1614
<td>Upper left of keypad</td>
 
1615
</tr>
 
1616
<tr class="row-odd"><td><code class="docutils literal"><span class="pre">KEY_A3</span></code></td>
 
1617
<td>Upper right of keypad</td>
 
1618
</tr>
 
1619
<tr class="row-even"><td><code class="docutils literal"><span class="pre">KEY_B2</span></code></td>
 
1620
<td>Center of keypad</td>
 
1621
</tr>
 
1622
<tr class="row-odd"><td><code class="docutils literal"><span class="pre">KEY_C1</span></code></td>
 
1623
<td>Lower left of keypad</td>
 
1624
</tr>
 
1625
<tr class="row-even"><td><code class="docutils literal"><span class="pre">KEY_C3</span></code></td>
 
1626
<td>Lower right of keypad</td>
 
1627
</tr>
 
1628
<tr class="row-odd"><td><code class="docutils literal"><span class="pre">KEY_BTAB</span></code></td>
 
1629
<td>Back tab</td>
 
1630
</tr>
 
1631
<tr class="row-even"><td><code class="docutils literal"><span class="pre">KEY_BEG</span></code></td>
 
1632
<td>Beg (beginning)</td>
 
1633
</tr>
 
1634
<tr class="row-odd"><td><code class="docutils literal"><span class="pre">KEY_CANCEL</span></code></td>
 
1635
<td>Cancel</td>
 
1636
</tr>
 
1637
<tr class="row-even"><td><code class="docutils literal"><span class="pre">KEY_CLOSE</span></code></td>
 
1638
<td>Close</td>
 
1639
</tr>
 
1640
<tr class="row-odd"><td><code class="docutils literal"><span class="pre">KEY_COMMAND</span></code></td>
 
1641
<td>Cmd (command)</td>
 
1642
</tr>
 
1643
<tr class="row-even"><td><code class="docutils literal"><span class="pre">KEY_COPY</span></code></td>
 
1644
<td>Copy</td>
 
1645
</tr>
 
1646
<tr class="row-odd"><td><code class="docutils literal"><span class="pre">KEY_CREATE</span></code></td>
 
1647
<td>Create</td>
 
1648
</tr>
 
1649
<tr class="row-even"><td><code class="docutils literal"><span class="pre">KEY_END</span></code></td>
 
1650
<td>End</td>
 
1651
</tr>
 
1652
<tr class="row-odd"><td><code class="docutils literal"><span class="pre">KEY_EXIT</span></code></td>
 
1653
<td>Exit</td>
 
1654
</tr>
 
1655
<tr class="row-even"><td><code class="docutils literal"><span class="pre">KEY_FIND</span></code></td>
 
1656
<td>Find</td>
 
1657
</tr>
 
1658
<tr class="row-odd"><td><code class="docutils literal"><span class="pre">KEY_HELP</span></code></td>
 
1659
<td>Help</td>
 
1660
</tr>
 
1661
<tr class="row-even"><td><code class="docutils literal"><span class="pre">KEY_MARK</span></code></td>
 
1662
<td>Mark</td>
 
1663
</tr>
 
1664
<tr class="row-odd"><td><code class="docutils literal"><span class="pre">KEY_MESSAGE</span></code></td>
 
1665
<td>Message</td>
 
1666
</tr>
 
1667
<tr class="row-even"><td><code class="docutils literal"><span class="pre">KEY_MOVE</span></code></td>
 
1668
<td>Move</td>
 
1669
</tr>
 
1670
<tr class="row-odd"><td><code class="docutils literal"><span class="pre">KEY_NEXT</span></code></td>
 
1671
<td>Next</td>
 
1672
</tr>
 
1673
<tr class="row-even"><td><code class="docutils literal"><span class="pre">KEY_OPEN</span></code></td>
 
1674
<td>Open</td>
 
1675
</tr>
 
1676
<tr class="row-odd"><td><code class="docutils literal"><span class="pre">KEY_OPTIONS</span></code></td>
 
1677
<td>Options</td>
 
1678
</tr>
 
1679
<tr class="row-even"><td><code class="docutils literal"><span class="pre">KEY_PREVIOUS</span></code></td>
 
1680
<td>Prev (previous)</td>
 
1681
</tr>
 
1682
<tr class="row-odd"><td><code class="docutils literal"><span class="pre">KEY_REDO</span></code></td>
 
1683
<td>Redo</td>
 
1684
</tr>
 
1685
<tr class="row-even"><td><code class="docutils literal"><span class="pre">KEY_REFERENCE</span></code></td>
 
1686
<td>Ref (reference)</td>
 
1687
</tr>
 
1688
<tr class="row-odd"><td><code class="docutils literal"><span class="pre">KEY_REFRESH</span></code></td>
 
1689
<td>Refresh</td>
 
1690
</tr>
 
1691
<tr class="row-even"><td><code class="docutils literal"><span class="pre">KEY_REPLACE</span></code></td>
 
1692
<td>Replace</td>
 
1693
</tr>
 
1694
<tr class="row-odd"><td><code class="docutils literal"><span class="pre">KEY_RESTART</span></code></td>
 
1695
<td>Restart</td>
 
1696
</tr>
 
1697
<tr class="row-even"><td><code class="docutils literal"><span class="pre">KEY_RESUME</span></code></td>
 
1698
<td>Resume</td>
 
1699
</tr>
 
1700
<tr class="row-odd"><td><code class="docutils literal"><span class="pre">KEY_SAVE</span></code></td>
 
1701
<td>Save</td>
 
1702
</tr>
 
1703
<tr class="row-even"><td><code class="docutils literal"><span class="pre">KEY_SBEG</span></code></td>
 
1704
<td>Shifted Beg (beginning)</td>
 
1705
</tr>
 
1706
<tr class="row-odd"><td><code class="docutils literal"><span class="pre">KEY_SCANCEL</span></code></td>
 
1707
<td>Shifted Cancel</td>
 
1708
</tr>
 
1709
<tr class="row-even"><td><code class="docutils literal"><span class="pre">KEY_SCOMMAND</span></code></td>
 
1710
<td>Shifted Command</td>
 
1711
</tr>
 
1712
<tr class="row-odd"><td><code class="docutils literal"><span class="pre">KEY_SCOPY</span></code></td>
 
1713
<td>Shifted Copy</td>
 
1714
</tr>
 
1715
<tr class="row-even"><td><code class="docutils literal"><span class="pre">KEY_SCREATE</span></code></td>
 
1716
<td>Shifted Create</td>
 
1717
</tr>
 
1718
<tr class="row-odd"><td><code class="docutils literal"><span class="pre">KEY_SDC</span></code></td>
 
1719
<td>Shifted Delete char</td>
 
1720
</tr>
 
1721
<tr class="row-even"><td><code class="docutils literal"><span class="pre">KEY_SDL</span></code></td>
 
1722
<td>Shifted Delete line</td>
 
1723
</tr>
 
1724
<tr class="row-odd"><td><code class="docutils literal"><span class="pre">KEY_SELECT</span></code></td>
 
1725
<td>Select</td>
 
1726
</tr>
 
1727
<tr class="row-even"><td><code class="docutils literal"><span class="pre">KEY_SEND</span></code></td>
 
1728
<td>Shifted End</td>
 
1729
</tr>
 
1730
<tr class="row-odd"><td><code class="docutils literal"><span class="pre">KEY_SEOL</span></code></td>
 
1731
<td>Shifted Clear line</td>
 
1732
</tr>
 
1733
<tr class="row-even"><td><code class="docutils literal"><span class="pre">KEY_SEXIT</span></code></td>
 
1734
<td>Shifted Dxit</td>
 
1735
</tr>
 
1736
<tr class="row-odd"><td><code class="docutils literal"><span class="pre">KEY_SFIND</span></code></td>
 
1737
<td>Shifted Find</td>
 
1738
</tr>
 
1739
<tr class="row-even"><td><code class="docutils literal"><span class="pre">KEY_SHELP</span></code></td>
 
1740
<td>Shifted Help</td>
 
1741
</tr>
 
1742
<tr class="row-odd"><td><code class="docutils literal"><span class="pre">KEY_SHOME</span></code></td>
 
1743
<td>Shifted Home</td>
 
1744
</tr>
 
1745
<tr class="row-even"><td><code class="docutils literal"><span class="pre">KEY_SIC</span></code></td>
 
1746
<td>Shifted Input</td>
 
1747
</tr>
 
1748
<tr class="row-odd"><td><code class="docutils literal"><span class="pre">KEY_SLEFT</span></code></td>
 
1749
<td>Shifted Left arrow</td>
 
1750
</tr>
 
1751
<tr class="row-even"><td><code class="docutils literal"><span class="pre">KEY_SMESSAGE</span></code></td>
 
1752
<td>Shifted Message</td>
 
1753
</tr>
 
1754
<tr class="row-odd"><td><code class="docutils literal"><span class="pre">KEY_SMOVE</span></code></td>
 
1755
<td>Shifted Move</td>
 
1756
</tr>
 
1757
<tr class="row-even"><td><code class="docutils literal"><span class="pre">KEY_SNEXT</span></code></td>
 
1758
<td>Shifted Next</td>
 
1759
</tr>
 
1760
<tr class="row-odd"><td><code class="docutils literal"><span class="pre">KEY_SOPTIONS</span></code></td>
 
1761
<td>Shifted Options</td>
 
1762
</tr>
 
1763
<tr class="row-even"><td><code class="docutils literal"><span class="pre">KEY_SPREVIOUS</span></code></td>
 
1764
<td>Shifted Prev</td>
 
1765
</tr>
 
1766
<tr class="row-odd"><td><code class="docutils literal"><span class="pre">KEY_SPRINT</span></code></td>
 
1767
<td>Shifted Print</td>
 
1768
</tr>
 
1769
<tr class="row-even"><td><code class="docutils literal"><span class="pre">KEY_SREDO</span></code></td>
 
1770
<td>Shifted Redo</td>
 
1771
</tr>
 
1772
<tr class="row-odd"><td><code class="docutils literal"><span class="pre">KEY_SREPLACE</span></code></td>
 
1773
<td>Shifted Replace</td>
 
1774
</tr>
 
1775
<tr class="row-even"><td><code class="docutils literal"><span class="pre">KEY_SRIGHT</span></code></td>
 
1776
<td>Shifted Right arrow</td>
 
1777
</tr>
 
1778
<tr class="row-odd"><td><code class="docutils literal"><span class="pre">KEY_SRSUME</span></code></td>
 
1779
<td>Shifted Resume</td>
 
1780
</tr>
 
1781
<tr class="row-even"><td><code class="docutils literal"><span class="pre">KEY_SSAVE</span></code></td>
 
1782
<td>Shifted Save</td>
 
1783
</tr>
 
1784
<tr class="row-odd"><td><code class="docutils literal"><span class="pre">KEY_SSUSPEND</span></code></td>
 
1785
<td>Shifted Suspend</td>
 
1786
</tr>
 
1787
<tr class="row-even"><td><code class="docutils literal"><span class="pre">KEY_SUNDO</span></code></td>
 
1788
<td>Shifted Undo</td>
 
1789
</tr>
 
1790
<tr class="row-odd"><td><code class="docutils literal"><span class="pre">KEY_SUSPEND</span></code></td>
 
1791
<td>Suspend</td>
 
1792
</tr>
 
1793
<tr class="row-even"><td><code class="docutils literal"><span class="pre">KEY_UNDO</span></code></td>
 
1794
<td>Undo</td>
 
1795
</tr>
 
1796
<tr class="row-odd"><td><code class="docutils literal"><span class="pre">KEY_MOUSE</span></code></td>
 
1797
<td>Mouse event has occurred</td>
 
1798
</tr>
 
1799
<tr class="row-even"><td><code class="docutils literal"><span class="pre">KEY_RESIZE</span></code></td>
 
1800
<td>Terminal resize event</td>
 
1801
</tr>
 
1802
<tr class="row-odd"><td><code class="docutils literal"><span class="pre">KEY_MAX</span></code></td>
 
1803
<td>Maximum key value</td>
 
1804
</tr>
 
1805
</tbody>
 
1806
</table>
 
1807
<p>On VT100s and their software emulations, such as X terminal emulators, there are
 
1808
normally at least four function keys (<code class="xref py py-const docutils literal"><span class="pre">KEY_F1</span></code>, <code class="xref py py-const docutils literal"><span class="pre">KEY_F2</span></code>,
 
1809
<code class="xref py py-const docutils literal"><span class="pre">KEY_F3</span></code>, <code class="xref py py-const docutils literal"><span class="pre">KEY_F4</span></code>) available, and the arrow keys mapped to
 
1810
<code class="xref py py-const docutils literal"><span class="pre">KEY_UP</span></code>, <code class="xref py py-const docutils literal"><span class="pre">KEY_DOWN</span></code>, <code class="xref py py-const docutils literal"><span class="pre">KEY_LEFT</span></code> and <code class="xref py py-const docutils literal"><span class="pre">KEY_RIGHT</span></code> in
 
1811
the obvious way.  If your machine has a PC keyboard, it is safe to expect arrow
 
1812
keys and twelve function keys (older PC keyboards may have only ten function
 
1813
keys); also, the following keypad mappings are standard:</p>
 
1814
<table border="1" class="docutils">
 
1815
<colgroup>
 
1816
<col width="62%" />
 
1817
<col width="38%" />
 
1818
</colgroup>
 
1819
<thead valign="bottom">
 
1820
<tr class="row-odd"><th class="head">Keycap</th>
 
1821
<th class="head">Constant</th>
 
1822
</tr>
 
1823
</thead>
 
1824
<tbody valign="top">
 
1825
<tr class="row-even"><td><code class="kbd docutils literal"><span class="pre">Insert</span></code></td>
 
1826
<td>KEY_IC</td>
 
1827
</tr>
 
1828
<tr class="row-odd"><td><code class="kbd docutils literal"><span class="pre">Delete</span></code></td>
 
1829
<td>KEY_DC</td>
 
1830
</tr>
 
1831
<tr class="row-even"><td><code class="kbd docutils literal"><span class="pre">Home</span></code></td>
 
1832
<td>KEY_HOME</td>
 
1833
</tr>
 
1834
<tr class="row-odd"><td><code class="kbd docutils literal"><span class="pre">End</span></code></td>
 
1835
<td>KEY_END</td>
 
1836
</tr>
 
1837
<tr class="row-even"><td><code class="kbd docutils literal"><span class="pre">Page</span> <span class="pre">Up</span></code></td>
 
1838
<td>KEY_PPAGE</td>
 
1839
</tr>
 
1840
<tr class="row-odd"><td><code class="kbd docutils literal"><span class="pre">Page</span> <span class="pre">Down</span></code></td>
 
1841
<td>KEY_NPAGE</td>
 
1842
</tr>
 
1843
</tbody>
 
1844
</table>
 
1845
<p>The following table lists characters from the alternate character set. These are
 
1846
inherited from the VT100 terminal, and will generally be  available on software
 
1847
emulations such as X terminals.  When there is no graphic available, curses
 
1848
falls back on a crude printable ASCII approximation.</p>
 
1849
<div class="admonition note">
 
1850
<p class="first admonition-title">Note</p>
 
1851
<p class="last">These are available only after <a class="reference internal" href="#curses.initscr" title="curses.initscr"><code class="xref py py-func docutils literal"><span class="pre">initscr()</span></code></a> has  been called.</p>
 
1852
</div>
 
1853
<table border="1" class="docutils">
 
1854
<colgroup>
 
1855
<col width="30%" />
 
1856
<col width="70%" />
 
1857
</colgroup>
 
1858
<thead valign="bottom">
 
1859
<tr class="row-odd"><th class="head">ACS code</th>
 
1860
<th class="head">Meaning</th>
 
1861
</tr>
 
1862
</thead>
 
1863
<tbody valign="top">
 
1864
<tr class="row-even"><td><code class="docutils literal"><span class="pre">ACS_BBSS</span></code></td>
 
1865
<td>alternate name for upper right corner</td>
 
1866
</tr>
 
1867
<tr class="row-odd"><td><code class="docutils literal"><span class="pre">ACS_BLOCK</span></code></td>
 
1868
<td>solid square block</td>
 
1869
</tr>
 
1870
<tr class="row-even"><td><code class="docutils literal"><span class="pre">ACS_BOARD</span></code></td>
 
1871
<td>board of squares</td>
 
1872
</tr>
 
1873
<tr class="row-odd"><td><code class="docutils literal"><span class="pre">ACS_BSBS</span></code></td>
 
1874
<td>alternate name for horizontal line</td>
 
1875
</tr>
 
1876
<tr class="row-even"><td><code class="docutils literal"><span class="pre">ACS_BSSB</span></code></td>
 
1877
<td>alternate name for upper left corner</td>
 
1878
</tr>
 
1879
<tr class="row-odd"><td><code class="docutils literal"><span class="pre">ACS_BSSS</span></code></td>
 
1880
<td>alternate name for top tee</td>
 
1881
</tr>
 
1882
<tr class="row-even"><td><code class="docutils literal"><span class="pre">ACS_BTEE</span></code></td>
 
1883
<td>bottom tee</td>
 
1884
</tr>
 
1885
<tr class="row-odd"><td><code class="docutils literal"><span class="pre">ACS_BULLET</span></code></td>
 
1886
<td>bullet</td>
 
1887
</tr>
 
1888
<tr class="row-even"><td><code class="docutils literal"><span class="pre">ACS_CKBOARD</span></code></td>
 
1889
<td>checker board (stipple)</td>
 
1890
</tr>
 
1891
<tr class="row-odd"><td><code class="docutils literal"><span class="pre">ACS_DARROW</span></code></td>
 
1892
<td>arrow pointing down</td>
 
1893
</tr>
 
1894
<tr class="row-even"><td><code class="docutils literal"><span class="pre">ACS_DEGREE</span></code></td>
 
1895
<td>degree symbol</td>
 
1896
</tr>
 
1897
<tr class="row-odd"><td><code class="docutils literal"><span class="pre">ACS_DIAMOND</span></code></td>
 
1898
<td>diamond</td>
 
1899
</tr>
 
1900
<tr class="row-even"><td><code class="docutils literal"><span class="pre">ACS_GEQUAL</span></code></td>
 
1901
<td>greater-than-or-equal-to</td>
 
1902
</tr>
 
1903
<tr class="row-odd"><td><code class="docutils literal"><span class="pre">ACS_HLINE</span></code></td>
 
1904
<td>horizontal line</td>
 
1905
</tr>
 
1906
<tr class="row-even"><td><code class="docutils literal"><span class="pre">ACS_LANTERN</span></code></td>
 
1907
<td>lantern symbol</td>
 
1908
</tr>
 
1909
<tr class="row-odd"><td><code class="docutils literal"><span class="pre">ACS_LARROW</span></code></td>
 
1910
<td>left arrow</td>
 
1911
</tr>
 
1912
<tr class="row-even"><td><code class="docutils literal"><span class="pre">ACS_LEQUAL</span></code></td>
 
1913
<td>less-than-or-equal-to</td>
 
1914
</tr>
 
1915
<tr class="row-odd"><td><code class="docutils literal"><span class="pre">ACS_LLCORNER</span></code></td>
 
1916
<td>lower left-hand corner</td>
 
1917
</tr>
 
1918
<tr class="row-even"><td><code class="docutils literal"><span class="pre">ACS_LRCORNER</span></code></td>
 
1919
<td>lower right-hand corner</td>
 
1920
</tr>
 
1921
<tr class="row-odd"><td><code class="docutils literal"><span class="pre">ACS_LTEE</span></code></td>
 
1922
<td>left tee</td>
 
1923
</tr>
 
1924
<tr class="row-even"><td><code class="docutils literal"><span class="pre">ACS_NEQUAL</span></code></td>
 
1925
<td>not-equal sign</td>
 
1926
</tr>
 
1927
<tr class="row-odd"><td><code class="docutils literal"><span class="pre">ACS_PI</span></code></td>
 
1928
<td>letter pi</td>
 
1929
</tr>
 
1930
<tr class="row-even"><td><code class="docutils literal"><span class="pre">ACS_PLMINUS</span></code></td>
 
1931
<td>plus-or-minus sign</td>
 
1932
</tr>
 
1933
<tr class="row-odd"><td><code class="docutils literal"><span class="pre">ACS_PLUS</span></code></td>
 
1934
<td>big plus sign</td>
 
1935
</tr>
 
1936
<tr class="row-even"><td><code class="docutils literal"><span class="pre">ACS_RARROW</span></code></td>
 
1937
<td>right arrow</td>
 
1938
</tr>
 
1939
<tr class="row-odd"><td><code class="docutils literal"><span class="pre">ACS_RTEE</span></code></td>
 
1940
<td>right tee</td>
 
1941
</tr>
 
1942
<tr class="row-even"><td><code class="docutils literal"><span class="pre">ACS_S1</span></code></td>
 
1943
<td>scan line 1</td>
 
1944
</tr>
 
1945
<tr class="row-odd"><td><code class="docutils literal"><span class="pre">ACS_S3</span></code></td>
 
1946
<td>scan line 3</td>
 
1947
</tr>
 
1948
<tr class="row-even"><td><code class="docutils literal"><span class="pre">ACS_S7</span></code></td>
 
1949
<td>scan line 7</td>
 
1950
</tr>
 
1951
<tr class="row-odd"><td><code class="docutils literal"><span class="pre">ACS_S9</span></code></td>
 
1952
<td>scan line 9</td>
 
1953
</tr>
 
1954
<tr class="row-even"><td><code class="docutils literal"><span class="pre">ACS_SBBS</span></code></td>
 
1955
<td>alternate name for lower right corner</td>
 
1956
</tr>
 
1957
<tr class="row-odd"><td><code class="docutils literal"><span class="pre">ACS_SBSB</span></code></td>
 
1958
<td>alternate name for vertical line</td>
 
1959
</tr>
 
1960
<tr class="row-even"><td><code class="docutils literal"><span class="pre">ACS_SBSS</span></code></td>
 
1961
<td>alternate name for right tee</td>
 
1962
</tr>
 
1963
<tr class="row-odd"><td><code class="docutils literal"><span class="pre">ACS_SSBB</span></code></td>
 
1964
<td>alternate name for lower left corner</td>
 
1965
</tr>
 
1966
<tr class="row-even"><td><code class="docutils literal"><span class="pre">ACS_SSBS</span></code></td>
 
1967
<td>alternate name for bottom tee</td>
 
1968
</tr>
 
1969
<tr class="row-odd"><td><code class="docutils literal"><span class="pre">ACS_SSSB</span></code></td>
 
1970
<td>alternate name for left tee</td>
 
1971
</tr>
 
1972
<tr class="row-even"><td><code class="docutils literal"><span class="pre">ACS_SSSS</span></code></td>
 
1973
<td>alternate name for crossover or big plus</td>
 
1974
</tr>
 
1975
<tr class="row-odd"><td><code class="docutils literal"><span class="pre">ACS_STERLING</span></code></td>
 
1976
<td>pound sterling</td>
 
1977
</tr>
 
1978
<tr class="row-even"><td><code class="docutils literal"><span class="pre">ACS_TTEE</span></code></td>
 
1979
<td>top tee</td>
 
1980
</tr>
 
1981
<tr class="row-odd"><td><code class="docutils literal"><span class="pre">ACS_UARROW</span></code></td>
 
1982
<td>up arrow</td>
 
1983
</tr>
 
1984
<tr class="row-even"><td><code class="docutils literal"><span class="pre">ACS_ULCORNER</span></code></td>
 
1985
<td>upper left corner</td>
 
1986
</tr>
 
1987
<tr class="row-odd"><td><code class="docutils literal"><span class="pre">ACS_URCORNER</span></code></td>
 
1988
<td>upper right corner</td>
 
1989
</tr>
 
1990
<tr class="row-even"><td><code class="docutils literal"><span class="pre">ACS_VLINE</span></code></td>
 
1991
<td>vertical line</td>
 
1992
</tr>
 
1993
</tbody>
 
1994
</table>
 
1995
<p>The following table lists the predefined colors:</p>
 
1996
<table border="1" class="docutils">
 
1997
<colgroup>
 
1998
<col width="40%" />
 
1999
<col width="60%" />
 
2000
</colgroup>
 
2001
<thead valign="bottom">
 
2002
<tr class="row-odd"><th class="head">Constant</th>
 
2003
<th class="head">Color</th>
 
2004
</tr>
 
2005
</thead>
 
2006
<tbody valign="top">
 
2007
<tr class="row-even"><td><code class="docutils literal"><span class="pre">COLOR_BLACK</span></code></td>
 
2008
<td>Black</td>
 
2009
</tr>
 
2010
<tr class="row-odd"><td><code class="docutils literal"><span class="pre">COLOR_BLUE</span></code></td>
 
2011
<td>Blue</td>
 
2012
</tr>
 
2013
<tr class="row-even"><td><code class="docutils literal"><span class="pre">COLOR_CYAN</span></code></td>
 
2014
<td>Cyan (light greenish blue)</td>
 
2015
</tr>
 
2016
<tr class="row-odd"><td><code class="docutils literal"><span class="pre">COLOR_GREEN</span></code></td>
 
2017
<td>Green</td>
 
2018
</tr>
 
2019
<tr class="row-even"><td><code class="docutils literal"><span class="pre">COLOR_MAGENTA</span></code></td>
 
2020
<td>Magenta (purplish red)</td>
 
2021
</tr>
 
2022
<tr class="row-odd"><td><code class="docutils literal"><span class="pre">COLOR_RED</span></code></td>
 
2023
<td>Red</td>
 
2024
</tr>
 
2025
<tr class="row-even"><td><code class="docutils literal"><span class="pre">COLOR_WHITE</span></code></td>
 
2026
<td>White</td>
 
2027
</tr>
 
2028
<tr class="row-odd"><td><code class="docutils literal"><span class="pre">COLOR_YELLOW</span></code></td>
 
2029
<td>Yellow</td>
 
2030
</tr>
 
2031
</tbody>
 
2032
</table>
 
2033
</div>
 
2034
</div>
 
2035
<div class="section" id="module-curses.textpad">
 
2036
<span id="curses-textpad-text-input-widget-for-curses-programs"></span><h1>15.12. <a class="reference internal" href="#module-curses.textpad" title="curses.textpad: Emacs-like input editing in a curses window."><code class="xref py py-mod docutils literal"><span class="pre">curses.textpad</span></code></a> &#8212; Text input widget for curses programs<a class="headerlink" href="#module-curses.textpad" title="Permalink to this headline">¶</a></h1>
 
2037
<div class="versionadded">
 
2038
<p><span class="versionmodified">New in version 1.6.</span></p>
 
2039
</div>
 
2040
<p>The <a class="reference internal" href="#module-curses.textpad" title="curses.textpad: Emacs-like input editing in a curses window."><code class="xref py py-mod docutils literal"><span class="pre">curses.textpad</span></code></a> module provides a <a class="reference internal" href="#curses.textpad.Textbox" title="curses.textpad.Textbox"><code class="xref py py-class docutils literal"><span class="pre">Textbox</span></code></a> class that handles
 
2041
elementary text editing in a curses window, supporting a set of keybindings
 
2042
resembling those of Emacs (thus, also of Netscape Navigator, BBedit 6.x,
 
2043
FrameMaker, and many other programs).  The module also provides a
 
2044
rectangle-drawing function useful for framing text boxes or for other purposes.</p>
 
2045
<p>The module <a class="reference internal" href="#module-curses.textpad" title="curses.textpad: Emacs-like input editing in a curses window."><code class="xref py py-mod docutils literal"><span class="pre">curses.textpad</span></code></a> defines the following function:</p>
 
2046
<dl class="function">
 
2047
<dt id="curses.textpad.rectangle">
 
2048
<code class="descclassname">curses.textpad.</code><code class="descname">rectangle</code><span class="sig-paren">(</span><em>win</em>, <em>uly</em>, <em>ulx</em>, <em>lry</em>, <em>lrx</em><span class="sig-paren">)</span><a class="headerlink" href="#curses.textpad.rectangle" title="Permalink to this definition">¶</a></dt>
 
2049
<dd><p>Draw a rectangle.  The first argument must be a window object; the remaining
 
2050
arguments are coordinates relative to that window.  The second and third
 
2051
arguments are the y and x coordinates of the upper left hand corner of the
 
2052
rectangle to be drawn; the fourth and fifth arguments are the y and x
 
2053
coordinates of the lower right hand corner. The rectangle will be drawn using
 
2054
VT100/IBM PC forms characters on terminals that make this possible (including
 
2055
xterm and most other software terminal emulators).  Otherwise it will be drawn
 
2056
with ASCII  dashes, vertical bars, and plus signs.</p>
 
2057
</dd></dl>
 
2058
 
 
2059
<div class="section" id="textbox-objects">
 
2060
<span id="curses-textpad-objects"></span><h2>15.12.1. Textbox objects<a class="headerlink" href="#textbox-objects" title="Permalink to this headline">¶</a></h2>
 
2061
<p>You can instantiate a <a class="reference internal" href="#curses.textpad.Textbox" title="curses.textpad.Textbox"><code class="xref py py-class docutils literal"><span class="pre">Textbox</span></code></a> object as follows:</p>
 
2062
<dl class="class">
 
2063
<dt id="curses.textpad.Textbox">
 
2064
<em class="property">class </em><code class="descclassname">curses.textpad.</code><code class="descname">Textbox</code><span class="sig-paren">(</span><em>win</em><span class="sig-paren">)</span><a class="headerlink" href="#curses.textpad.Textbox" title="Permalink to this definition">¶</a></dt>
 
2065
<dd><p>Return a textbox widget object.  The <em>win</em> argument should be a curses
 
2066
<code class="xref py py-class docutils literal"><span class="pre">WindowObject</span></code> in which the textbox is to be contained. The edit cursor
 
2067
of the textbox is initially located at the upper left hand corner of the
 
2068
containing window, with coordinates <code class="docutils literal"><span class="pre">(0,</span> <span class="pre">0)</span></code>. The instance&#8217;s
 
2069
<a class="reference internal" href="#curses.textpad.Textbox.stripspaces" title="curses.textpad.Textbox.stripspaces"><code class="xref py py-attr docutils literal"><span class="pre">stripspaces</span></code></a> flag is initially on.</p>
 
2070
<p><a class="reference internal" href="#curses.textpad.Textbox" title="curses.textpad.Textbox"><code class="xref py py-class docutils literal"><span class="pre">Textbox</span></code></a> objects have the following methods:</p>
 
2071
<dl class="method">
 
2072
<dt id="curses.textpad.Textbox.edit">
 
2073
<code class="descname">edit</code><span class="sig-paren">(</span><span class="optional">[</span><em>validator</em><span class="optional">]</span><span class="sig-paren">)</span><a class="headerlink" href="#curses.textpad.Textbox.edit" title="Permalink to this definition">¶</a></dt>
 
2074
<dd><p>This is the entry point you will normally use.  It accepts editing
 
2075
keystrokes until one of the termination keystrokes is entered.  If
 
2076
<em>validator</em> is supplied, it must be a function.  It will be called for
 
2077
each keystroke entered with the keystroke as a parameter; command dispatch
 
2078
is done on the result. This method returns the window contents as a
 
2079
string; whether blanks in the window are included is affected by the
 
2080
<a class="reference internal" href="#curses.textpad.Textbox.stripspaces" title="curses.textpad.Textbox.stripspaces"><code class="xref py py-attr docutils literal"><span class="pre">stripspaces</span></code></a> attribute.</p>
 
2081
</dd></dl>
 
2082
 
 
2083
<dl class="method">
 
2084
<dt id="curses.textpad.Textbox.do_command">
 
2085
<code class="descname">do_command</code><span class="sig-paren">(</span><em>ch</em><span class="sig-paren">)</span><a class="headerlink" href="#curses.textpad.Textbox.do_command" title="Permalink to this definition">¶</a></dt>
 
2086
<dd><p>Process a single command keystroke.  Here are the supported special
 
2087
keystrokes:</p>
 
2088
<table border="1" class="docutils">
 
2089
<colgroup>
 
2090
<col width="30%" />
 
2091
<col width="70%" />
 
2092
</colgroup>
 
2093
<thead valign="bottom">
 
2094
<tr class="row-odd"><th class="head">Keystroke</th>
 
2095
<th class="head">Action</th>
 
2096
</tr>
 
2097
</thead>
 
2098
<tbody valign="top">
 
2099
<tr class="row-even"><td><code class="kbd docutils literal"><span class="pre">Control-A</span></code></td>
 
2100
<td>Go to left edge of window.</td>
 
2101
</tr>
 
2102
<tr class="row-odd"><td><code class="kbd docutils literal"><span class="pre">Control-B</span></code></td>
 
2103
<td>Cursor left, wrapping to previous line if
 
2104
appropriate.</td>
 
2105
</tr>
 
2106
<tr class="row-even"><td><code class="kbd docutils literal"><span class="pre">Control-D</span></code></td>
 
2107
<td>Delete character under cursor.</td>
 
2108
</tr>
 
2109
<tr class="row-odd"><td><code class="kbd docutils literal"><span class="pre">Control-E</span></code></td>
 
2110
<td>Go to right edge (stripspaces off) or end
 
2111
of line (stripspaces on).</td>
 
2112
</tr>
 
2113
<tr class="row-even"><td><code class="kbd docutils literal"><span class="pre">Control-F</span></code></td>
 
2114
<td>Cursor right, wrapping to next line when
 
2115
appropriate.</td>
 
2116
</tr>
 
2117
<tr class="row-odd"><td><code class="kbd docutils literal"><span class="pre">Control-G</span></code></td>
 
2118
<td>Terminate, returning the window contents.</td>
 
2119
</tr>
 
2120
<tr class="row-even"><td><code class="kbd docutils literal"><span class="pre">Control-H</span></code></td>
 
2121
<td>Delete character backward.</td>
 
2122
</tr>
 
2123
<tr class="row-odd"><td><code class="kbd docutils literal"><span class="pre">Control-J</span></code></td>
 
2124
<td>Terminate if the window is 1 line,
 
2125
otherwise insert newline.</td>
 
2126
</tr>
 
2127
<tr class="row-even"><td><code class="kbd docutils literal"><span class="pre">Control-K</span></code></td>
 
2128
<td>If line is blank, delete it, otherwise
 
2129
clear to end of line.</td>
 
2130
</tr>
 
2131
<tr class="row-odd"><td><code class="kbd docutils literal"><span class="pre">Control-L</span></code></td>
 
2132
<td>Refresh screen.</td>
 
2133
</tr>
 
2134
<tr class="row-even"><td><code class="kbd docutils literal"><span class="pre">Control-N</span></code></td>
 
2135
<td>Cursor down; move down one line.</td>
 
2136
</tr>
 
2137
<tr class="row-odd"><td><code class="kbd docutils literal"><span class="pre">Control-O</span></code></td>
 
2138
<td>Insert a blank line at cursor location.</td>
 
2139
</tr>
 
2140
<tr class="row-even"><td><code class="kbd docutils literal"><span class="pre">Control-P</span></code></td>
 
2141
<td>Cursor up; move up one line.</td>
 
2142
</tr>
 
2143
</tbody>
 
2144
</table>
 
2145
<p>Move operations do nothing if the cursor is at an edge where the movement
 
2146
is not possible.  The following synonyms are supported where possible:</p>
 
2147
<table border="1" class="docutils">
 
2148
<colgroup>
 
2149
<col width="57%" />
 
2150
<col width="43%" />
 
2151
</colgroup>
 
2152
<thead valign="bottom">
 
2153
<tr class="row-odd"><th class="head">Constant</th>
 
2154
<th class="head">Keystroke</th>
 
2155
</tr>
 
2156
</thead>
 
2157
<tbody valign="top">
 
2158
<tr class="row-even"><td><code class="xref py py-const docutils literal"><span class="pre">KEY_LEFT</span></code></td>
 
2159
<td><code class="kbd docutils literal"><span class="pre">Control-B</span></code></td>
 
2160
</tr>
 
2161
<tr class="row-odd"><td><code class="xref py py-const docutils literal"><span class="pre">KEY_RIGHT</span></code></td>
 
2162
<td><code class="kbd docutils literal"><span class="pre">Control-F</span></code></td>
 
2163
</tr>
 
2164
<tr class="row-even"><td><code class="xref py py-const docutils literal"><span class="pre">KEY_UP</span></code></td>
 
2165
<td><code class="kbd docutils literal"><span class="pre">Control-P</span></code></td>
 
2166
</tr>
 
2167
<tr class="row-odd"><td><code class="xref py py-const docutils literal"><span class="pre">KEY_DOWN</span></code></td>
 
2168
<td><code class="kbd docutils literal"><span class="pre">Control-N</span></code></td>
 
2169
</tr>
 
2170
<tr class="row-even"><td><code class="xref py py-const docutils literal"><span class="pre">KEY_BACKSPACE</span></code></td>
 
2171
<td><code class="kbd docutils literal"><span class="pre">Control-h</span></code></td>
 
2172
</tr>
 
2173
</tbody>
 
2174
</table>
 
2175
<p>All other keystrokes are treated as a command to insert the given
 
2176
character and move right (with line wrapping).</p>
 
2177
</dd></dl>
 
2178
 
 
2179
<dl class="method">
 
2180
<dt id="curses.textpad.Textbox.gather">
 
2181
<code class="descname">gather</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#curses.textpad.Textbox.gather" title="Permalink to this definition">¶</a></dt>
 
2182
<dd><p>Return the window contents as a string; whether blanks in the
 
2183
window are included is affected by the <a class="reference internal" href="#curses.textpad.Textbox.stripspaces" title="curses.textpad.Textbox.stripspaces"><code class="xref py py-attr docutils literal"><span class="pre">stripspaces</span></code></a> member.</p>
 
2184
</dd></dl>
 
2185
 
 
2186
<dl class="attribute">
 
2187
<dt id="curses.textpad.Textbox.stripspaces">
 
2188
<code class="descname">stripspaces</code><a class="headerlink" href="#curses.textpad.Textbox.stripspaces" title="Permalink to this definition">¶</a></dt>
 
2189
<dd><p>This attribute is a flag which controls the interpretation of blanks in
 
2190
the window.  When it is on, trailing blanks on each line are ignored; any
 
2191
cursor motion that would land the cursor on a trailing blank goes to the
 
2192
end of that line instead, and trailing blanks are stripped when the window
 
2193
contents are gathered.</p>
 
2194
</dd></dl>
 
2195
 
 
2196
</dd></dl>
 
2197
 
 
2198
</div>
 
2199
</div>
 
2200
 
 
2201
 
 
2202
          </div>
 
2203
        </div>
 
2204
      </div>
 
2205
      <div class="sphinxsidebar" role="navigation" aria-label="main navigation">
 
2206
        <div class="sphinxsidebarwrapper">
 
2207
  <h3><a href="../contents.html">Table Of Contents</a></h3>
 
2208
  <ul>
 
2209
<li><a class="reference internal" href="#">15.11. <code class="docutils literal"><span class="pre">curses</span></code> &#8212; Terminal handling for character-cell displays</a><ul>
 
2210
<li><a class="reference internal" href="#functions">15.11.1. Functions</a></li>
 
2211
<li><a class="reference internal" href="#window-objects">15.11.2. Window Objects</a></li>
 
2212
<li><a class="reference internal" href="#constants">15.11.3. Constants</a></li>
 
2213
</ul>
 
2214
</li>
 
2215
<li><a class="reference internal" href="#module-curses.textpad">15.12. <code class="docutils literal"><span class="pre">curses.textpad</span></code> &#8212; Text input widget for curses programs</a><ul>
 
2216
<li><a class="reference internal" href="#textbox-objects">15.12.1. Textbox objects</a></li>
 
2217
</ul>
 
2218
</li>
 
2219
</ul>
 
2220
 
 
2221
  <h4>Previous topic</h4>
 
2222
  <p class="topless"><a href="getpass.html"
 
2223
                        title="previous chapter">15.10. <code class="docutils literal"><span class="pre">getpass</span></code> &#8212; Portable password input</a></p>
 
2224
  <h4>Next topic</h4>
 
2225
  <p class="topless"><a href="curses.ascii.html"
 
2226
                        title="next chapter">15.13. <code class="docutils literal"><span class="pre">curses.ascii</span></code> &#8212; Utilities for ASCII characters</a></p>
 
2227
<h3>This Page</h3>
 
2228
<ul class="this-page-menu">
 
2229
  <li><a href="../bugs.html">Report a Bug</a></li>
 
2230
  <li><a href="../_sources/library/curses.txt"
 
2231
         rel="nofollow">Show Source</a></li>
 
2232
</ul>
 
2233
 
 
2234
<div id="searchbox" style="display: none" role="search">
 
2235
  <h3>Quick search</h3>
 
2236
    <form class="search" action="../search.html" method="get">
 
2237
      <input type="text" name="q" />
 
2238
      <input type="submit" value="Go" />
 
2239
      <input type="hidden" name="check_keywords" value="yes" />
 
2240
      <input type="hidden" name="area" value="default" />
 
2241
    </form>
 
2242
    <p class="searchtip" style="font-size: 90%">
 
2243
    Enter search terms or a module, class or function name.
 
2244
    </p>
 
2245
</div>
 
2246
<script type="text/javascript">$('#searchbox').show(0);</script>
 
2247
        </div>
 
2248
      </div>
 
2249
      <div class="clearer"></div>
 
2250
    </div>  
 
2251
    <div class="related" role="navigation" aria-label="related navigation">
 
2252
      <h3>Navigation</h3>
 
2253
      <ul>
 
2254
        <li class="right" style="margin-right: 10px">
 
2255
          <a href="../genindex.html" title="General Index"
 
2256
             >index</a></li>
 
2257
        <li class="right" >
 
2258
          <a href="../py-modindex.html" title="Python Module Index"
 
2259
             >modules</a> |</li>
 
2260
        <li class="right" >
 
2261
          <a href="curses.ascii.html" title="15.13. curses.ascii — Utilities for ASCII characters"
 
2262
             >next</a> |</li>
 
2263
        <li class="right" >
 
2264
          <a href="getpass.html" title="15.10. getpass — Portable password input"
 
2265
             >previous</a> |</li>
 
2266
        <li><img src="../_static/py.png" alt=""
 
2267
                 style="vertical-align: middle; margin-top: -1px"/></li>
 
2268
        <li><a href="https://www.python.org/">Python</a> &raquo;</li>
 
2269
        <li>
 
2270
          <span class="version_switcher_placeholder">2.7.12</span>
 
2271
          <a href="../index.html">Documentation</a> &raquo;
 
2272
        </li>
 
2273
 
 
2274
          <li class="nav-item nav-item-1"><a href="index.html" >The Python Standard Library</a> &raquo;</li>
 
2275
          <li class="nav-item nav-item-2"><a href="allos.html" >15. Generic Operating System Services</a> &raquo;</li> 
 
2276
      </ul>
 
2277
    </div>  
 
2278
    <div class="footer">
 
2279
    &copy; <a href="../copyright.html">Copyright</a> 1990-2016, Python Software Foundation.
 
2280
    <br />
 
2281
    The Python Software Foundation is a non-profit corporation.
 
2282
    <a href="https://www.python.org/psf/donations/">Please donate.</a>
 
2283
    <br />
 
2284
    Last updated on Nov 26, 2016.
 
2285
    <a href="../bugs.html">Found a bug</a>?
 
2286
    <br />
 
2287
    Created using <a href="http://sphinx.pocoo.org/">Sphinx</a> 1.3.3.
 
2288
    </div>
 
2289
 
 
2290
  </body>
 
2291
</html>
 
 
b'\\ No newline at end of file'