-
Notifications
You must be signed in to change notification settings - Fork 10
Expand file tree
/
Copy pathcurses.html
More file actions
3628 lines (3237 loc) · 273 KB
/
Copy pathcurses.html
File metadata and controls
3628 lines (3237 loc) · 273 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
<!DOCTYPE html>
<html lang="fa" data-content_root="../">
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" /><meta name="viewport" content="width=device-width, initial-scale=1" />
<meta property="og:title" content="curses --- Terminal handling for character-cell displays" />
<meta property="og:type" content="website" />
<meta property="og:url" content="https://docs.python.org/3/library/curses.html" />
<meta property="og:site_name" content="Python documentation" />
<meta property="og:description" content="Source code: Lib/curses The curses module provides an interface to the curses library, the de-facto standard for portable advanced terminal handling. While curses is most widely used in the Unix en..." />
<meta property="og:image" content="_static/og-image.png" />
<meta property="og:image:alt" content="Python documentation" />
<meta name="description" content="Source code: Lib/curses The curses module provides an interface to the curses library, the de-facto standard for portable advanced terminal handling. While curses is most widely used in the Unix en..." />
<meta name="theme-color" content="#3776ab">
<meta property="og:image:width" content="200">
<meta property="og:image:height" content="200">
<title>curses --- Terminal handling for character-cell displays — مستندات Python3.14.6</title><meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="stylesheet" type="text/css" href="../_static/pygments.css?v=b86133f3" />
<link rel="stylesheet" type="text/css" href="../_static/classic.css?v=234b1a7c" />
<link rel="stylesheet" type="text/css" href="../_static/pydoctheme.css?v=4365c8fe" />
<link id="pygments_dark_css" media="(prefers-color-scheme: dark)" rel="stylesheet" type="text/css" href="../_static/pygments_dark.css?v=0fc419ee" />
<script src="../_static/documentation_options.js?v=e254dbbb"></script>
<script src="../_static/doctools.js?v=9bcbadda"></script>
<script src="../_static/sphinx_highlight.js?v=dc90522c"></script>
<script src="../_static/translations.js?v=5df48d09"></script>
<script src="../_static/sidebar.js"></script>
<link rel="search" type="application/opensearchdescription+xml"
title="جستجو در مستندات Python3.14.6"
href="../_static/opensearch.xml"/>
<link rel="author" title="درباره این مستندات" href="../about.html" />
<link rel="index" title="فهرست" href="../genindex.html" />
<link rel="search" title="جستجو" href="../search.html" />
<link rel="copyright" title="حق چاپ" href="../copyright.html" />
<link rel="next" title="curses.ascii --- Utilities for ASCII characters" href="curses.ascii.html" />
<link rel="prev" title="fileinput --- Iterate over lines from multiple input streams" href="fileinput.html" />
<link rel="canonical" href="https://docs.python.org/3/library/curses.html">
<style>
@media only screen {
table.full-width-table {
width: 100%;
}
}
</style>
<link rel="stylesheet" href="../_static/pydoctheme_dark.css" media="(prefers-color-scheme: dark)" id="pydoctheme_dark_css">
<link rel="shortcut icon" type="image/png" href="../_static/py.svg">
<script type="text/javascript" src="../_static/copybutton.js"></script>
<script type="text/javascript" src="../_static/menu.js"></script>
<script type="text/javascript" src="../_static/search-focus.js"></script>
<script type="text/javascript" src="../_static/themetoggle.js"></script>
<script type="text/javascript" src="../_static/rtd_switcher.js"></script>
<meta name="readthedocs-addons-api-version" content="1">
</head>
<body>
<div class="mobile-nav">
<input type="checkbox" id="menuToggler" class="toggler__input" aria-controls="navigation"
aria-pressed="false" aria-expanded="false" role="button" aria-label="Menu">
<nav class="nav-content" role="navigation">
<label for="menuToggler" class="toggler__label">
<span></span>
</label>
<span class="nav-items-wrapper">
<a href="https://www.python.org/" class="nav-logo">
<img src="../_static/py.svg" alt="Python logo">
</a>
<span class="version_switcher_placeholder"></span>
<form role="search" class="search" action="../search.html" method="get">
<svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" class="search-icon">
<path fill-rule="nonzero" fill="currentColor" d="M15.5 14h-.79l-.28-.27a6.5 6.5 0 001.48-5.34c-.47-2.78-2.79-5-5.59-5.34a6.505 6.505 0 00-7.27 7.27c.34 2.8 2.56 5.12 5.34 5.59a6.5 6.5 0 005.34-1.48l.27.28v.79l4.25 4.25c.41.41 1.08.41 1.49 0 .41-.41.41-1.08 0-1.49L15.5 14zm-6 0C7.01 14 5 11.99 5 9.5S7.01 5 9.5 5 14 7.01 14 9.5 11.99 14 9.5 14z"></path>
</svg>
<input placeholder="جستجو سریع" aria-label="جستجو سریع" type="search" name="q">
<input type="submit" value="برو">
</form>
</span>
</nav>
<div class="menu-wrapper">
<nav class="menu" role="navigation" aria-label="main navigation">
<div class="language_switcher_placeholder"></div>
<label class="theme-selector-label">
Theme
<select class="theme-selector" oninput="activateTheme(this.value)">
<option value="auto" selected>Auto</option>
<option value="light">Light</option>
<option value="dark">Dark</option>
</select>
</label>
<div>
<h3><a href="../contents.html">فهرست عناوین</a></h3>
<ul>
<li><a class="reference internal" href="#"><code class="xref py py-mod docutils literal notranslate"><span class="pre">curses</span></code> --- Terminal handling for character-cell displays</a><ul>
<li><a class="reference internal" href="#functions">Functions</a></li>
<li><a class="reference internal" href="#window-objects">Window Objects</a></li>
<li><a class="reference internal" href="#constants">Constants</a></li>
</ul>
</li>
<li><a class="reference internal" href="#module-curses.textpad"><code class="xref py py-mod docutils literal notranslate"><span class="pre">curses.textpad</span></code> --- Text input widget for curses programs</a><ul>
<li><a class="reference internal" href="#textbox-objects">Textbox objects</a></li>
</ul>
</li>
</ul>
</div>
<div>
<h4>موضوع قبلی</h4>
<p class="topless"><a href="fileinput.html"
title="فصل قبلی"><code class="xref py py-mod docutils literal notranslate"><span class="pre">fileinput</span></code> --- Iterate over lines from multiple input streams</a></p>
</div>
<div>
<h4>موضوع بعدی</h4>
<p class="topless"><a href="curses.ascii.html"
title="فصل بعدی"><code class="xref py py-mod docutils literal notranslate"><span class="pre">curses.ascii</span></code> --- Utilities for ASCII characters</a></p>
</div>
<script>
document.addEventListener('DOMContentLoaded', () => {
const title = document.querySelector('meta[property="og:title"]').content;
const elements = document.querySelectorAll('.improvepage');
const pageurl = window.location.href.split('?')[0];
elements.forEach(element => {
const url = new URL(element.href.split('?')[0].replace("-nojs", ""));
url.searchParams.set('pagetitle', title);
url.searchParams.set('pageurl', pageurl);
url.searchParams.set('pagesource', "library/curses.rst");
element.href = url.toString();
});
});
</script>
<div role="note" aria-label="source link">
<h3>این صفحه</h3>
<ul class="this-page-menu">
<li><a href="../bugs.html">گزارش یک اشکال</a></li>
<li><a class="improvepage" href="../improve-page-nojs.html">بهبود این صفحه</a></li>
<li>
<a href="https://github.com/python/cpython/blob/main/Doc/library/curses.rst?plain=1"
rel="nofollow">نمایش منبع
</a>
</li>
<li>
<a href="https://github.com/python/python-docs-fa/blob/3.14/library/curses.po?plain=1"
rel="nofollow">نمایش منبع ترجمه</a>
</li>
</ul>
</div>
</nav>
</div>
</div>
<div class="related" role="navigation" aria-label="Related">
<h3>ناوبری</h3>
<ul>
<li class="right" style="margin-right: 10px">
<a href="../genindex.html" title="فهرست کلی"
accesskey="I">فهرست</a></li>
<li class="right" >
<a href="../py-modindex.html" title="نمایه ی ماژول های پایتون"
>ماژول ها</a> |</li>
<li class="right" >
<a href="curses.ascii.html" title="curses.ascii --- Utilities for ASCII characters"
accesskey="N">بعدی</a> |</li>
<li class="right" >
<a href="fileinput.html" title="fileinput --- Iterate over lines from multiple input streams"
accesskey="P">قبلی</a> |</li>
<li><img src="../_static/py.svg" alt="Python logo" style="vertical-align: middle; margin-top: -1px"></li>
<li><a href="https://www.python.org/">Python</a> »</li>
<li class="switchers">
<div class="language_switcher_placeholder"></div>
<div class="version_switcher_placeholder"></div>
</li>
<li>
</li>
<li id="cpython-language-and-version">
<a href="../index.html">3.14.6 Documentation</a> »
</li>
<li class="nav-item nav-item-1"><a href="index.html" >The Python Standard Library</a> »</li>
<li class="nav-item nav-item-2"><a href="cmdlinelibs.html" accesskey="U">Command-line interface libraries</a> »</li>
<li class="nav-item nav-item-this"><a href=""><code class="xref py py-mod docutils literal notranslate"><span class="pre">curses</span></code> --- Terminal handling for character-cell displays</a></li>
<li class="right">
<div class="inline-search" role="search">
<form class="inline-search" action="../search.html" method="get">
<input placeholder="جستجو سریع" aria-label="جستجو سریع" type="search" name="q" id="search-box">
<input type="submit" value="برو">
</form>
</div>
|
</li>
<li class="right">
<label class="theme-selector-label">
Theme
<select class="theme-selector" oninput="activateTheme(this.value)">
<option value="auto" selected>Auto</option>
<option value="light">Light</option>
<option value="dark">Dark</option>
</select>
</label> |</li>
</ul>
</div>
<div class="document">
<div class="documentwrapper">
<div class="bodywrapper">
<div class="body" role="main">
<section id="module-curses">
<span id="curses-terminal-handling-for-character-cell-displays"></span><h1><code class="xref py py-mod docutils literal notranslate"><span class="pre">curses</span></code> --- Terminal handling for character-cell displays<a class="headerlink" href="#module-curses" title="Link to this heading">¶</a></h1>
<p><strong>Source code:</strong> <a class="extlink-source reference external" href="https://github.com/python/cpython/tree/3.14/Lib/curses">Lib/curses</a></p>
<hr class="docutils" />
<p>The <code class="xref py py-mod docutils literal notranslate"><span class="pre">curses</span></code> module provides an interface to the curses library, the
de-facto standard for portable advanced terminal handling.</p>
<p>While curses is most widely used in the Unix environment, versions are available
for Windows, DOS, and possibly other systems as well. This extension module is
designed to match the API of ncurses, an open-source curses library hosted on
Linux and the BSD variants of Unix.</p>
<div class="availability docutils container">
<p><a class="reference internal" href="intro.html#availability"><span class="std std-ref">در دسترس بودن</span></a>: not Android, not iOS, not WASI.</p>
<p>This module is not supported on <a class="reference internal" href="intro.html#mobile-availability"><span class="std std-ref">mobile platforms</span></a>
or <a class="reference internal" href="intro.html#wasm-availability"><span class="std std-ref">WebAssembly platforms</span></a>.</p>
</div>
<p>This is an <a class="reference internal" href="../glossary.html#term-optional-module"><span class="xref std std-term">optional module</span></a>.
If it is missing from your copy of CPython,
look for documentation from your distributor (that is,
whoever provided Python to you).
If you are the distributor, see <a class="reference internal" href="../using/configure.html#optional-module-requirements"><span class="std std-ref">Requirements for optional modules</span></a>.</p>
<div class="availability docutils container">
<p><a class="reference internal" href="intro.html#availability"><span class="std std-ref">در دسترس بودن</span></a>: Unix.</p>
</div>
<div class="admonition note">
<p class="admonition-title">توجه</p>
<p>Whenever the documentation mentions a <em>character</em> it can be specified
as an integer, a one-character Unicode string or a one-byte byte string.</p>
<p>Whenever the documentation mentions a <em>character string</em> it can be specified
as a Unicode string or a byte string.</p>
</div>
<div class="admonition seealso">
<p class="admonition-title">همچنین ملاحظه نمائید</p>
<dl class="simple">
<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 notranslate"><span class="pre">curses.ascii</span></code></a></dt><dd><p>Utilities for working with ASCII characters, regardless of your locale settings.</p>
</dd>
<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 notranslate"><span class="pre">curses.panel</span></code></a></dt><dd><p>A panel stack extension that adds depth to curses windows.</p>
</dd>
<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 notranslate"><span class="pre">curses.textpad</span></code></a></dt><dd><p>Editable text widget for curses supporting <strong class="program">Emacs</strong>-like bindings.</p>
</dd>
<dt><a class="reference internal" href="../howto/curses.html#curses-howto"><span class="std std-ref">Curses Programming with Python</span></a></dt><dd><p>Tutorial material on using curses with Python, by Andrew Kuchling and Eric
Raymond.</p>
</dd>
</dl>
</div>
<section id="functions">
<span id="curses-functions"></span><h2>Functions<a class="headerlink" href="#functions" title="Link to this heading">¶</a></h2>
<p>The module <code class="xref py py-mod docutils literal notranslate"><span class="pre">curses</span></code> defines the following exception:</p>
<dl class="py exception">
<dt class="sig sig-object py" id="curses.error">
<em class="property"><span class="k"><span class="pre">exception</span></span><span class="w"> </span></em><span class="sig-prename descclassname"><span class="pre">curses.</span></span><span class="sig-name descname"><span class="pre">error</span></span><a class="headerlink" href="#curses.error" title="Link to this definition">¶</a></dt>
<dd><p>Exception raised when a curses library function returns an error.</p>
</dd></dl>
<div class="admonition note">
<p class="admonition-title">توجه</p>
<p>Whenever <em>x</em> or <em>y</em> arguments to a function or a method are optional, they
default to the current cursor location. Whenever <em>attr</em> is optional, it defaults
to <a class="reference internal" href="#curses.A_NORMAL" title="curses.A_NORMAL"><code class="xref py py-const docutils literal notranslate"><span class="pre">A_NORMAL</span></code></a>.</p>
</div>
<p>The module <code class="xref py py-mod docutils literal notranslate"><span class="pre">curses</span></code> defines the following functions:</p>
<dl class="py function">
<dt class="sig sig-object py" id="curses.assume_default_colors">
<span class="sig-prename descclassname"><span class="pre">curses.</span></span><span class="sig-name descname"><span class="pre">assume_default_colors</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">fg</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">bg</span></span></em>, <em class="sig-param"><span class="positional-only-separator o"><abbr title="Positional-only parameter separator (PEP 570)"><span class="pre">/</span></abbr></span></em><span class="sig-paren">)</span><a class="headerlink" href="#curses.assume_default_colors" title="Link to this definition">¶</a></dt>
<dd><p>Allow use of default values for colors on terminals supporting this feature.
Use this to support transparency in your application.</p>
<ul class="simple">
<li><p>Assign terminal default foreground/background colors to color number <code class="docutils literal notranslate"><span class="pre">-1</span></code>.
So <code class="docutils literal notranslate"><span class="pre">init_pair(x,</span> <span class="pre">COLOR_RED,</span> <span class="pre">-1)</span></code> will initialize pair <em>x</em> as red
on default background and <code class="docutils literal notranslate"><span class="pre">init_pair(x,</span> <span class="pre">-1,</span> <span class="pre">COLOR_BLUE)</span></code> will
initialize pair <em>x</em> as default foreground on blue.</p></li>
<li><p>Change the definition of the color-pair <code class="docutils literal notranslate"><span class="pre">0</span></code> to <code class="docutils literal notranslate"><span class="pre">(fg,</span> <span class="pre">bg)</span></code>.</p></li>
</ul>
<div class="versionadded">
<p><span class="versionmodified added">Added in version 3.14.</span></p>
</div>
</dd></dl>
<dl class="py function">
<dt class="sig sig-object py" id="curses.baudrate">
<span class="sig-prename descclassname"><span class="pre">curses.</span></span><span class="sig-name descname"><span class="pre">baudrate</span></span><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#curses.baudrate" title="Link to this definition">¶</a></dt>
<dd><p>Return the output speed of the terminal in bits per second. On software
terminal emulators it will have a fixed high value. Included for historical
reasons; in former times, it was used to write output loops for time delays and
occasionally to change interfaces depending on the line speed.</p>
</dd></dl>
<dl class="py function">
<dt class="sig sig-object py" id="curses.beep">
<span class="sig-prename descclassname"><span class="pre">curses.</span></span><span class="sig-name descname"><span class="pre">beep</span></span><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#curses.beep" title="Link to this definition">¶</a></dt>
<dd><p>Emit a short attention sound.</p>
</dd></dl>
<dl class="py function">
<dt class="sig sig-object py" id="curses.can_change_color">
<span class="sig-prename descclassname"><span class="pre">curses.</span></span><span class="sig-name descname"><span class="pre">can_change_color</span></span><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#curses.can_change_color" title="Link to this definition">¶</a></dt>
<dd><p>Return <code class="docutils literal notranslate"><span class="pre">True</span></code> or <code class="docutils literal notranslate"><span class="pre">False</span></code>, depending on whether the programmer can change the colors
displayed by the terminal.</p>
</dd></dl>
<dl class="py function">
<dt class="sig sig-object py" id="curses.cbreak">
<span class="sig-prename descclassname"><span class="pre">curses.</span></span><span class="sig-name descname"><span class="pre">cbreak</span></span><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#curses.cbreak" title="Link to this definition">¶</a></dt>
<dd><p>Enter cbreak mode. In cbreak mode (sometimes called "rare" mode) normal tty
line buffering is turned off and characters are available to be read one by one.
However, unlike raw mode, special characters (interrupt, quit, suspend, and flow
control) retain their effects on the tty driver and calling program. Calling
first <a class="reference internal" href="#curses.raw" title="curses.raw"><code class="xref py py-func docutils literal notranslate"><span class="pre">raw()</span></code></a> then <code class="xref py py-func docutils literal notranslate"><span class="pre">cbreak()</span></code> leaves the terminal in cbreak mode.</p>
</dd></dl>
<dl class="py function">
<dt class="sig sig-object py" id="curses.color_content">
<span class="sig-prename descclassname"><span class="pre">curses.</span></span><span class="sig-name descname"><span class="pre">color_content</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">color_number</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#curses.color_content" title="Link to this definition">¶</a></dt>
<dd><p>Return the intensity of the red, green, and blue (RGB) components in the color
<em>color_number</em>, which must be between <code class="docutils literal notranslate"><span class="pre">0</span></code> and <code class="docutils literal notranslate"><span class="pre">COLORS</span> <span class="pre">-</span> <span class="pre">1</span></code>. Return a 3-tuple,
containing the R,G,B values for the given color, which will be between
<code class="docutils literal notranslate"><span class="pre">0</span></code> (no component) and <code class="docutils literal notranslate"><span class="pre">1000</span></code> (maximum amount of component).</p>
</dd></dl>
<dl class="py function">
<dt class="sig sig-object py" id="curses.color_pair">
<span class="sig-prename descclassname"><span class="pre">curses.</span></span><span class="sig-name descname"><span class="pre">color_pair</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">pair_number</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#curses.color_pair" title="Link to this definition">¶</a></dt>
<dd><p>Return the attribute value for displaying text in the specified color pair.
Only the first 256 color pairs are supported. This
attribute value can be combined with <a class="reference internal" href="#curses.A_STANDOUT" title="curses.A_STANDOUT"><code class="xref py py-const docutils literal notranslate"><span class="pre">A_STANDOUT</span></code></a>, <a class="reference internal" href="#curses.A_REVERSE" title="curses.A_REVERSE"><code class="xref py py-const docutils literal notranslate"><span class="pre">A_REVERSE</span></code></a>,
and the other <code class="xref py py-const docutils literal notranslate"><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 notranslate"><span class="pre">pair_number()</span></code></a> is the counterpart
to this function.</p>
</dd></dl>
<dl class="py function">
<dt class="sig sig-object py" id="curses.curs_set">
<span class="sig-prename descclassname"><span class="pre">curses.</span></span><span class="sig-name descname"><span class="pre">curs_set</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">visibility</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#curses.curs_set" title="Link to this definition">¶</a></dt>
<dd><p>Set the cursor state. <em>visibility</em> can be set to <code class="docutils literal notranslate"><span class="pre">0</span></code>, <code class="docutils literal notranslate"><span class="pre">1</span></code>, or <code class="docutils literal notranslate"><span class="pre">2</span></code>, for invisible,
normal, or very visible. If the terminal supports the visibility requested, return the
previous cursor state; otherwise raise an exception. On many
terminals, the "visible" mode is an underline cursor and the "very visible" mode
is a block cursor.</p>
</dd></dl>
<dl class="py function">
<dt class="sig sig-object py" id="curses.def_prog_mode">
<span class="sig-prename descclassname"><span class="pre">curses.</span></span><span class="sig-name descname"><span class="pre">def_prog_mode</span></span><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#curses.def_prog_mode" title="Link to this definition">¶</a></dt>
<dd><p>Save the current terminal mode as the "program" mode, the mode when the running
program is using curses. (Its counterpart is the "shell" mode, for when the
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 notranslate"><span class="pre">reset_prog_mode()</span></code></a> will
restore this mode.</p>
</dd></dl>
<dl class="py function">
<dt class="sig sig-object py" id="curses.def_shell_mode">
<span class="sig-prename descclassname"><span class="pre">curses.</span></span><span class="sig-name descname"><span class="pre">def_shell_mode</span></span><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#curses.def_shell_mode" title="Link to this definition">¶</a></dt>
<dd><p>Save the current terminal mode as the "shell" mode, the mode when the running
program is not using curses. (Its counterpart is the "program" mode, when the
program is using curses capabilities.) Subsequent calls to
<a class="reference internal" href="#curses.reset_shell_mode" title="curses.reset_shell_mode"><code class="xref py py-func docutils literal notranslate"><span class="pre">reset_shell_mode()</span></code></a> will restore this mode.</p>
</dd></dl>
<dl class="py function">
<dt class="sig sig-object py" id="curses.delay_output">
<span class="sig-prename descclassname"><span class="pre">curses.</span></span><span class="sig-name descname"><span class="pre">delay_output</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">ms</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#curses.delay_output" title="Link to this definition">¶</a></dt>
<dd><p>Insert an <em>ms</em> millisecond pause in output.</p>
</dd></dl>
<dl class="py function">
<dt class="sig sig-object py" id="curses.doupdate">
<span class="sig-prename descclassname"><span class="pre">curses.</span></span><span class="sig-name descname"><span class="pre">doupdate</span></span><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#curses.doupdate" title="Link to this definition">¶</a></dt>
<dd><p>Update the physical screen. The curses library keeps two data structures, one
representing the current physical screen contents and a virtual screen
representing the desired next state. The <code class="xref py py-func docutils literal notranslate"><span class="pre">doupdate()</span></code> ground updates the
physical screen to match the virtual screen.</p>
<p>The virtual screen may be updated by a <a class="reference internal" href="#curses.window.noutrefresh" title="curses.window.noutrefresh"><code class="xref py py-meth docutils literal notranslate"><span class="pre">noutrefresh()</span></code></a> call after write
operations such as <a class="reference internal" href="#curses.window.addstr" title="curses.window.addstr"><code class="xref py py-meth docutils literal notranslate"><span class="pre">addstr()</span></code></a> have been performed on a window. The normal
<a class="reference internal" href="#curses.window.refresh" title="curses.window.refresh"><code class="xref py py-meth docutils literal notranslate"><span class="pre">refresh()</span></code></a> call is simply <code class="xref py py-meth docutils literal notranslate"><span class="pre">noutrefresh()</span></code> followed by <code class="xref py py-func docutils literal notranslate"><span class="pre">doupdate()</span></code>;
if you have to update multiple windows, you can speed performance and perhaps
reduce screen flicker by issuing <code class="xref py py-meth docutils literal notranslate"><span class="pre">noutrefresh()</span></code> calls on all windows,
followed by a single <code class="xref py py-func docutils literal notranslate"><span class="pre">doupdate()</span></code>.</p>
</dd></dl>
<dl class="py function">
<dt class="sig sig-object py" id="curses.echo">
<span class="sig-prename descclassname"><span class="pre">curses.</span></span><span class="sig-name descname"><span class="pre">echo</span></span><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#curses.echo" title="Link to this definition">¶</a></dt>
<dd><p>Enter echo mode. In echo mode, each character input is echoed to the screen as
it is entered.</p>
</dd></dl>
<dl class="py function">
<dt class="sig sig-object py" id="curses.endwin">
<span class="sig-prename descclassname"><span class="pre">curses.</span></span><span class="sig-name descname"><span class="pre">endwin</span></span><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#curses.endwin" title="Link to this definition">¶</a></dt>
<dd><p>De-initialize the library, and return terminal to normal status.</p>
</dd></dl>
<dl class="py function">
<dt class="sig sig-object py" id="curses.erasechar">
<span class="sig-prename descclassname"><span class="pre">curses.</span></span><span class="sig-name descname"><span class="pre">erasechar</span></span><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#curses.erasechar" title="Link to this definition">¶</a></dt>
<dd><p>Return the user's current erase character as a one-byte bytes object. Under Unix operating systems this
is a property of the controlling tty of the curses program, and is not set by
the curses library itself.</p>
</dd></dl>
<dl class="py function">
<dt class="sig sig-object py" id="curses.filter">
<span class="sig-prename descclassname"><span class="pre">curses.</span></span><span class="sig-name descname"><span class="pre">filter</span></span><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#curses.filter" title="Link to this definition">¶</a></dt>
<dd><p>The <code class="xref py py-func docutils literal notranslate"><span class="pre">filter()</span></code> 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 notranslate"><span class="pre">initscr()</span></code></a> is
called. The effect is that, during those calls, <span class="target" id="index-0"></span><code class="xref std std-envvar docutils literal notranslate"><span class="pre">LINES</span></code> is set to <code class="docutils literal notranslate"><span class="pre">1</span></code>; the
capabilities <code class="docutils literal notranslate"><span class="pre">clear</span></code>, <code class="docutils literal notranslate"><span class="pre">cup</span></code>, <code class="docutils literal notranslate"><span class="pre">cud</span></code>, <code class="docutils literal notranslate"><span class="pre">cud1</span></code>, <code class="docutils literal notranslate"><span class="pre">cuu1</span></code>, <code class="docutils literal notranslate"><span class="pre">cuu</span></code>, <code class="docutils literal notranslate"><span class="pre">vpa</span></code> are disabled; and the <code class="docutils literal notranslate"><span class="pre">home</span></code>
string is set to the value of <code class="docutils literal notranslate"><span class="pre">cr</span></code>. The effect is that the cursor is confined to
the current line, and so are screen updates. This may be used for enabling
character-at-a-time line editing without touching the rest of the screen.</p>
</dd></dl>
<dl class="py function">
<dt class="sig sig-object py" id="curses.flash">
<span class="sig-prename descclassname"><span class="pre">curses.</span></span><span class="sig-name descname"><span class="pre">flash</span></span><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#curses.flash" title="Link to this definition">¶</a></dt>
<dd><p>Flash the screen. That is, change it to reverse-video and then change it back
in a short interval. Some people prefer such as 'visible bell' to the audible
attention signal produced by <a class="reference internal" href="#curses.beep" title="curses.beep"><code class="xref py py-func docutils literal notranslate"><span class="pre">beep()</span></code></a>.</p>
</dd></dl>
<dl class="py function">
<dt class="sig sig-object py" id="curses.flushinp">
<span class="sig-prename descclassname"><span class="pre">curses.</span></span><span class="sig-name descname"><span class="pre">flushinp</span></span><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#curses.flushinp" title="Link to this definition">¶</a></dt>
<dd><p>Flush all input buffers. This throws away any typeahead that has been typed
by the user and has not yet been processed by the program.</p>
</dd></dl>
<dl class="py function">
<dt class="sig sig-object py" id="curses.getmouse">
<span class="sig-prename descclassname"><span class="pre">curses.</span></span><span class="sig-name descname"><span class="pre">getmouse</span></span><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#curses.getmouse" title="Link to this definition">¶</a></dt>
<dd><p>After <a class="reference internal" href="#curses.window.getch" title="curses.window.getch"><code class="xref py py-meth docutils literal notranslate"><span class="pre">getch()</span></code></a> returns <a class="reference internal" href="#curses.KEY_MOUSE" title="curses.KEY_MOUSE"><code class="xref py py-const docutils literal notranslate"><span class="pre">KEY_MOUSE</span></code></a> to signal a mouse event, this
method should be called to retrieve the queued mouse event, represented as a
5-tuple <code class="docutils literal notranslate"><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
multiple devices, and <em>x</em>, <em>y</em>, <em>z</em> are the event's coordinates. (<em>z</em> is
currently unused.) <em>bstate</em> is an integer value whose bits will be set to
indicate the type of event, and will be the bitwise OR of one or more of the
following constants, where <em>n</em> is the button number from 1 to 5:
<a class="reference internal" href="#curses.BUTTONn_PRESSED" title="curses.BUTTONn_PRESSED"><code class="xref py py-const docutils literal notranslate"><span class="pre">BUTTONn_PRESSED</span></code></a>, <a class="reference internal" href="#curses.BUTTONn_RELEASED" title="curses.BUTTONn_RELEASED"><code class="xref py py-const docutils literal notranslate"><span class="pre">BUTTONn_RELEASED</span></code></a>, <a class="reference internal" href="#curses.BUTTONn_CLICKED" title="curses.BUTTONn_CLICKED"><code class="xref py py-const docutils literal notranslate"><span class="pre">BUTTONn_CLICKED</span></code></a>,
<a class="reference internal" href="#curses.BUTTONn_DOUBLE_CLICKED" title="curses.BUTTONn_DOUBLE_CLICKED"><code class="xref py py-const docutils literal notranslate"><span class="pre">BUTTONn_DOUBLE_CLICKED</span></code></a>, <a class="reference internal" href="#curses.BUTTONn_TRIPLE_CLICKED" title="curses.BUTTONn_TRIPLE_CLICKED"><code class="xref py py-const docutils literal notranslate"><span class="pre">BUTTONn_TRIPLE_CLICKED</span></code></a>,
<a class="reference internal" href="#curses.BUTTON_SHIFT" title="curses.BUTTON_SHIFT"><code class="xref py py-const docutils literal notranslate"><span class="pre">BUTTON_SHIFT</span></code></a>, <a class="reference internal" href="#curses.BUTTON_CTRL" title="curses.BUTTON_CTRL"><code class="xref py py-const docutils literal notranslate"><span class="pre">BUTTON_CTRL</span></code></a>, <a class="reference internal" href="#curses.BUTTON_ALT" title="curses.BUTTON_ALT"><code class="xref py py-const docutils literal notranslate"><span class="pre">BUTTON_ALT</span></code></a>.</p>
<div class="versionchanged">
<p><span class="versionmodified changed">تغییر داده شده در نسخه 3.10: </span>The <code class="docutils literal notranslate"><span class="pre">BUTTON5_*</span></code> constants are now exposed if they are provided by the
underlying curses library.</p>
</div>
</dd></dl>
<dl class="py function">
<dt class="sig sig-object py" id="curses.getsyx">
<span class="sig-prename descclassname"><span class="pre">curses.</span></span><span class="sig-name descname"><span class="pre">getsyx</span></span><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#curses.getsyx" title="Link to this definition">¶</a></dt>
<dd><p>Return the current coordinates of the virtual screen cursor as a tuple
<code class="docutils literal notranslate"><span class="pre">(y,</span> <span class="pre">x)</span></code>. If <a class="reference internal" href="#curses.window.leaveok" title="curses.window.leaveok"><code class="xref py py-meth docutils literal notranslate"><span class="pre">leaveok</span></code></a> is currently <code class="docutils literal notranslate"><span class="pre">True</span></code>, then return <code class="docutils literal notranslate"><span class="pre">(-1,</span> <span class="pre">-1)</span></code>.</p>
</dd></dl>
<dl class="py function">
<dt class="sig sig-object py" id="curses.getwin">
<span class="sig-prename descclassname"><span class="pre">curses.</span></span><span class="sig-name descname"><span class="pre">getwin</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">file</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#curses.getwin" title="Link to this definition">¶</a></dt>
<dd><p>Read window related data stored in the file by an earlier <a class="reference internal" href="#curses.window.putwin" title="curses.window.putwin"><code class="xref py py-func docutils literal notranslate"><span class="pre">window.putwin()</span></code></a> call.
The routine then creates and initializes a new window using that data, returning
the new window object.</p>
</dd></dl>
<dl class="py function">
<dt class="sig sig-object py" id="curses.has_colors">
<span class="sig-prename descclassname"><span class="pre">curses.</span></span><span class="sig-name descname"><span class="pre">has_colors</span></span><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#curses.has_colors" title="Link to this definition">¶</a></dt>
<dd><p>Return <code class="docutils literal notranslate"><span class="pre">True</span></code> if the terminal can display colors; otherwise, return <code class="docutils literal notranslate"><span class="pre">False</span></code>.</p>
</dd></dl>
<dl class="py function">
<dt class="sig sig-object py" id="curses.has_extended_color_support">
<span class="sig-prename descclassname"><span class="pre">curses.</span></span><span class="sig-name descname"><span class="pre">has_extended_color_support</span></span><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#curses.has_extended_color_support" title="Link to this definition">¶</a></dt>
<dd><p>Return <code class="docutils literal notranslate"><span class="pre">True</span></code> if the module supports extended colors; otherwise, return
<code class="docutils literal notranslate"><span class="pre">False</span></code>. Extended color support allows more than 256 color pairs for
terminals that support more than 16 colors (e.g. xterm-256color).</p>
<p>Extended color support requires ncurses version 6.1 or later.</p>
<div class="versionadded">
<p><span class="versionmodified added">Added in version 3.10.</span></p>
</div>
</dd></dl>
<dl class="py function">
<dt class="sig sig-object py" id="curses.has_ic">
<span class="sig-prename descclassname"><span class="pre">curses.</span></span><span class="sig-name descname"><span class="pre">has_ic</span></span><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#curses.has_ic" title="Link to this definition">¶</a></dt>
<dd><p>Return <code class="docutils literal notranslate"><span class="pre">True</span></code> if the terminal has insert- and delete-character capabilities.
This function is included for historical reasons only, as all modern software
terminal emulators have such capabilities.</p>
</dd></dl>
<dl class="py function">
<dt class="sig sig-object py" id="curses.has_il">
<span class="sig-prename descclassname"><span class="pre">curses.</span></span><span class="sig-name descname"><span class="pre">has_il</span></span><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#curses.has_il" title="Link to this definition">¶</a></dt>
<dd><p>Return <code class="docutils literal notranslate"><span class="pre">True</span></code> if the terminal has insert- and delete-line capabilities, or can
simulate them using scrolling regions. This function is included for
historical reasons only, as all modern software terminal emulators have such
capabilities.</p>
</dd></dl>
<dl class="py function">
<dt class="sig sig-object py" id="curses.has_key">
<span class="sig-prename descclassname"><span class="pre">curses.</span></span><span class="sig-name descname"><span class="pre">has_key</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">ch</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#curses.has_key" title="Link to this definition">¶</a></dt>
<dd><p>Take a key value <em>ch</em>, and return <code class="docutils literal notranslate"><span class="pre">True</span></code> if the current terminal type recognizes
a key with that value.</p>
</dd></dl>
<dl class="py function">
<dt class="sig sig-object py" id="curses.halfdelay">
<span class="sig-prename descclassname"><span class="pre">curses.</span></span><span class="sig-name descname"><span class="pre">halfdelay</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">tenths</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#curses.halfdelay" title="Link to this definition">¶</a></dt>
<dd><p>Used for half-delay mode, which is similar to cbreak mode in that characters
typed by the user are immediately available to the program. However, after
blocking for <em>tenths</em> tenths of seconds, raise an exception if nothing has
been typed. The value of <em>tenths</em> must be a number between <code class="docutils literal notranslate"><span class="pre">1</span></code> and <code class="docutils literal notranslate"><span class="pre">255</span></code>. Use
<a class="reference internal" href="#curses.nocbreak" title="curses.nocbreak"><code class="xref py py-func docutils literal notranslate"><span class="pre">nocbreak()</span></code></a> to leave half-delay mode.</p>
</dd></dl>
<dl class="py function">
<dt class="sig sig-object py" id="curses.init_color">
<span class="sig-prename descclassname"><span class="pre">curses.</span></span><span class="sig-name descname"><span class="pre">init_color</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">color_number</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">r</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">g</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">b</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#curses.init_color" title="Link to this definition">¶</a></dt>
<dd><p>Change the definition of a color, taking the number of the color to be changed
followed by three RGB values (for the amounts of red, green, and blue
components). The value of <em>color_number</em> must be between <code class="docutils literal notranslate"><span class="pre">0</span></code> and
<code class="docutils literal notranslate"><span class="pre">COLORS</span> <span class="pre">-</span> <span class="pre">1</span></code>. Each of <em>r</em>, <em>g</em>, <em>b</em>, must be a value between <code class="docutils literal notranslate"><span class="pre">0</span></code> and
<code class="docutils literal notranslate"><span class="pre">1000</span></code>. When <code class="xref py py-func docutils literal notranslate"><span class="pre">init_color()</span></code> is used, all occurrences of that color on the
screen immediately change to the new definition. This function is a no-op on
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 notranslate"><span class="pre">can_change_color()</span></code></a> returns <code class="docutils literal notranslate"><span class="pre">True</span></code>.</p>
</dd></dl>
<dl class="py function">
<dt class="sig sig-object py" id="curses.init_pair">
<span class="sig-prename descclassname"><span class="pre">curses.</span></span><span class="sig-name descname"><span class="pre">init_pair</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">pair_number</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">fg</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">bg</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#curses.init_pair" title="Link to this definition">¶</a></dt>
<dd><p>Change the definition of a color-pair. It takes three arguments: the number of
the color-pair to be changed, the foreground color number, and the background
color number. The value of <em>pair_number</em> must be between <code class="docutils literal notranslate"><span class="pre">1</span></code> and
<code class="docutils literal notranslate"><span class="pre">COLOR_PAIRS</span> <span class="pre">-</span> <span class="pre">1</span></code> (the <code class="docutils literal notranslate"><span class="pre">0</span></code> color pair can only be changed by
<a class="reference internal" href="#curses.use_default_colors" title="curses.use_default_colors"><code class="xref py py-func docutils literal notranslate"><span class="pre">use_default_colors()</span></code></a> and <a class="reference internal" href="#curses.assume_default_colors" title="curses.assume_default_colors"><code class="xref py py-func docutils literal notranslate"><span class="pre">assume_default_colors()</span></code></a>).
The value of <em>fg</em> and <em>bg</em> arguments must be between <code class="docutils literal notranslate"><span class="pre">0</span></code> and
<code class="docutils literal notranslate"><span class="pre">COLORS</span> <span class="pre">-</span> <span class="pre">1</span></code>, or, after calling <code class="xref py py-func docutils literal notranslate"><span class="pre">use_default_colors()</span></code> or
<code class="xref py py-func docutils literal notranslate"><span class="pre">assume_default_colors()</span></code>, <code class="docutils literal notranslate"><span class="pre">-1</span></code>.
If the color-pair was previously initialized, the screen is
refreshed and all occurrences of that color-pair are changed to the new
definition.</p>
</dd></dl>
<dl class="py function">
<dt class="sig sig-object py" id="curses.initscr">
<span class="sig-prename descclassname"><span class="pre">curses.</span></span><span class="sig-name descname"><span class="pre">initscr</span></span><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#curses.initscr" title="Link to this definition">¶</a></dt>
<dd><p>Initialize the library. Return a <a class="reference internal" href="#curses-window-objects"><span class="std std-ref">window</span></a> object
which represents the whole screen.</p>
<div class="admonition note">
<p class="admonition-title">توجه</p>
<p>If there is an error opening the terminal, the underlying curses library may
cause the interpreter to exit.</p>
</div>
</dd></dl>
<dl class="py function">
<dt class="sig sig-object py" id="curses.is_term_resized">
<span class="sig-prename descclassname"><span class="pre">curses.</span></span><span class="sig-name descname"><span class="pre">is_term_resized</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">nlines</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">ncols</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#curses.is_term_resized" title="Link to this definition">¶</a></dt>
<dd><p>Return <code class="docutils literal notranslate"><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 notranslate"><span class="pre">resize_term()</span></code></a> would modify the window structure,
<code class="docutils literal notranslate"><span class="pre">False</span></code> otherwise.</p>
</dd></dl>
<dl class="py function">
<dt class="sig sig-object py" id="curses.isendwin">
<span class="sig-prename descclassname"><span class="pre">curses.</span></span><span class="sig-name descname"><span class="pre">isendwin</span></span><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#curses.isendwin" title="Link to this definition">¶</a></dt>
<dd><p>Return <code class="docutils literal notranslate"><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 notranslate"><span class="pre">endwin()</span></code></a> has been called (that is, the curses library has
been deinitialized).</p>
</dd></dl>
<dl class="py function">
<dt class="sig sig-object py" id="curses.keyname">
<span class="sig-prename descclassname"><span class="pre">curses.</span></span><span class="sig-name descname"><span class="pre">keyname</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">k</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#curses.keyname" title="Link to this definition">¶</a></dt>
<dd><p>Return the name of the key numbered <em>k</em> as a bytes object. The name of a key generating printable
ASCII character is the key's character. The name of a control-key combination
is a two-byte bytes object consisting of a caret (<code class="docutils literal notranslate"><span class="pre">b'^'</span></code>) followed by the corresponding
printable ASCII character. The name of an alt-key combination (128--255) is a
bytes object consisting of the prefix <code class="docutils literal notranslate"><span class="pre">b'M-'</span></code> followed by the name of the corresponding
ASCII character.</p>
</dd></dl>
<dl class="py function">
<dt class="sig sig-object py" id="curses.killchar">
<span class="sig-prename descclassname"><span class="pre">curses.</span></span><span class="sig-name descname"><span class="pre">killchar</span></span><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#curses.killchar" title="Link to this definition">¶</a></dt>
<dd><p>Return the user's current line kill character as a one-byte bytes object. Under Unix operating systems
this is a property of the controlling tty of the curses program, and is not set
by the curses library itself.</p>
</dd></dl>
<dl class="py function">
<dt class="sig sig-object py" id="curses.longname">
<span class="sig-prename descclassname"><span class="pre">curses.</span></span><span class="sig-name descname"><span class="pre">longname</span></span><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#curses.longname" title="Link to this definition">¶</a></dt>
<dd><p>Return a bytes object containing the terminfo long name field describing the current
terminal. The maximum length of a verbose description is 128 characters. It is
defined only after the call to <a class="reference internal" href="#curses.initscr" title="curses.initscr"><code class="xref py py-func docutils literal notranslate"><span class="pre">initscr()</span></code></a>.</p>
</dd></dl>
<dl class="py function">
<dt class="sig sig-object py" id="curses.meta">
<span class="sig-prename descclassname"><span class="pre">curses.</span></span><span class="sig-name descname"><span class="pre">meta</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">flag</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#curses.meta" title="Link to this definition">¶</a></dt>
<dd><p>If <em>flag</em> is <code class="docutils literal notranslate"><span class="pre">True</span></code>, allow 8-bit characters to be input. If
<em>flag</em> is <code class="docutils literal notranslate"><span class="pre">False</span></code>, allow only 7-bit chars.</p>
</dd></dl>
<dl class="py function">
<dt class="sig sig-object py" id="curses.mouseinterval">
<span class="sig-prename descclassname"><span class="pre">curses.</span></span><span class="sig-name descname"><span class="pre">mouseinterval</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">interval</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#curses.mouseinterval" title="Link to this definition">¶</a></dt>
<dd><p>Set the maximum time in milliseconds that can elapse between press and release
events in order for them to be recognized as a click, and return the previous
interval value. The default value is 200 milliseconds, or one fifth of a second.</p>
</dd></dl>
<dl class="py function">
<dt class="sig sig-object py" id="curses.mousemask">
<span class="sig-prename descclassname"><span class="pre">curses.</span></span><span class="sig-name descname"><span class="pre">mousemask</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">mousemask</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#curses.mousemask" title="Link to this definition">¶</a></dt>
<dd><p>Set the mouse events to be reported, and return a tuple <code class="docutils literal notranslate"><span class="pre">(availmask,</span>
<span class="pre">oldmask)</span></code>. <em>availmask</em> indicates which of the specified mouse events can be
reported; on complete failure it returns <code class="docutils literal notranslate"><span class="pre">0</span></code>. <em>oldmask</em> is the previous value of
the given window's mouse event mask. If this function is never called, no mouse
events are ever reported.</p>
</dd></dl>
<dl class="py function">
<dt class="sig sig-object py" id="curses.napms">
<span class="sig-prename descclassname"><span class="pre">curses.</span></span><span class="sig-name descname"><span class="pre">napms</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">ms</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#curses.napms" title="Link to this definition">¶</a></dt>
<dd><p>Sleep for <em>ms</em> milliseconds.</p>
</dd></dl>
<dl class="py function">
<dt class="sig sig-object py" id="curses.newpad">
<span class="sig-prename descclassname"><span class="pre">curses.</span></span><span class="sig-name descname"><span class="pre">newpad</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">nlines</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">ncols</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#curses.newpad" title="Link to this definition">¶</a></dt>
<dd><p>Create and return a pointer to a new pad data structure with the given number
of lines and columns. Return a pad as a window object.</p>
<p>A pad is like a window, except that it is not restricted by the screen size, and
is not necessarily associated with a particular part of the screen. Pads can be
used when a large window is needed, and only a part of the window will be on the
screen at one time. Automatic refreshes of pads (such as from scrolling or
echoing of input) do not occur. The <a class="reference internal" href="#curses.window.refresh" title="curses.window.refresh"><code class="xref py py-meth docutils literal notranslate"><span class="pre">refresh()</span></code></a> and <a class="reference internal" href="#curses.window.noutrefresh" title="curses.window.noutrefresh"><code class="xref py py-meth docutils literal notranslate"><span class="pre">noutrefresh()</span></code></a>
methods of a pad require 6 arguments to specify the part of the pad to be
displayed and the location on the screen to be used for the display. The
arguments are <em>pminrow</em>, <em>pmincol</em>, <em>sminrow</em>, <em>smincol</em>, <em>smaxrow</em>, <em>smaxcol</em>; the <em>p</em>
arguments refer to the upper left corner of the pad region to be displayed and
the <em>s</em> arguments define a clipping box on the screen within which the pad region
is to be displayed.</p>
</dd></dl>
<dl class="py function">
<dt class="sig sig-object py" id="curses.newwin">
<span class="sig-prename descclassname"><span class="pre">curses.</span></span><span class="sig-name descname"><span class="pre">newwin</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">nlines</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">ncols</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#curses.newwin" title="Link to this definition">¶</a></dt>
<dt class="sig sig-object py">
<span class="sig-prename descclassname"><span class="pre">curses.</span></span><span class="sig-name descname"><span class="pre">newwin</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">nlines</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">ncols</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">begin_y</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">begin_x</span></span></em><span class="sig-paren">)</span></dt>
<dd><p>Return a new <a class="reference internal" href="#curses-window-objects"><span class="std std-ref">window</span></a>, whose left-upper corner
is at <code class="docutils literal notranslate"><span class="pre">(begin_y,</span> <span class="pre">begin_x)</span></code>, and whose height/width is <em>nlines</em>/<em>ncols</em>.</p>
<p>By default, the window will extend from the specified position to the lower
right corner of the screen.</p>
</dd></dl>
<dl class="py function">
<dt class="sig sig-object py" id="curses.nl">
<span class="sig-prename descclassname"><span class="pre">curses.</span></span><span class="sig-name descname"><span class="pre">nl</span></span><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#curses.nl" title="Link to this definition">¶</a></dt>
<dd><p>Enter newline mode. This mode translates the return key into newline on input,
and translates newline into return and line-feed on output. Newline mode is
initially on.</p>
</dd></dl>
<dl class="py function">
<dt class="sig sig-object py" id="curses.nocbreak">
<span class="sig-prename descclassname"><span class="pre">curses.</span></span><span class="sig-name descname"><span class="pre">nocbreak</span></span><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#curses.nocbreak" title="Link to this definition">¶</a></dt>
<dd><p>Leave cbreak mode. Return to normal "cooked" mode with line buffering.</p>
</dd></dl>
<dl class="py function">
<dt class="sig sig-object py" id="curses.noecho">
<span class="sig-prename descclassname"><span class="pre">curses.</span></span><span class="sig-name descname"><span class="pre">noecho</span></span><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#curses.noecho" title="Link to this definition">¶</a></dt>
<dd><p>Leave echo mode. Echoing of input characters is turned off.</p>
</dd></dl>
<dl class="py function">
<dt class="sig sig-object py" id="curses.nonl">
<span class="sig-prename descclassname"><span class="pre">curses.</span></span><span class="sig-name descname"><span class="pre">nonl</span></span><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#curses.nonl" title="Link to this definition">¶</a></dt>
<dd><p>Leave newline mode. Disable translation of return into newline on input, and
disable low-level translation of newline into newline/return on output (but this
does not change the behavior of <code class="docutils literal notranslate"><span class="pre">addch('\n')</span></code>, which always does the
equivalent of return and line feed on the virtual screen). With translation
off, curses can sometimes speed up vertical motion a little; also, it will be
able to detect the return key on input.</p>
</dd></dl>
<dl class="py function">
<dt class="sig sig-object py" id="curses.noqiflush">
<span class="sig-prename descclassname"><span class="pre">curses.</span></span><span class="sig-name descname"><span class="pre">noqiflush</span></span><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#curses.noqiflush" title="Link to this definition">¶</a></dt>
<dd><p>When the <code class="xref py py-func docutils literal notranslate"><span class="pre">noqiflush()</span></code> routine is used, normal flush of input and output queues
associated with the <code class="docutils literal notranslate"><span class="pre">INTR</span></code>, <code class="docutils literal notranslate"><span class="pre">QUIT</span></code> and <code class="docutils literal notranslate"><span class="pre">SUSP</span></code> characters will not be done. You may
want to call <code class="xref py py-func docutils literal notranslate"><span class="pre">noqiflush()</span></code> in a signal handler if you want output to
continue as though the interrupt had not occurred, after the handler exits.</p>
</dd></dl>
<dl class="py function">
<dt class="sig sig-object py" id="curses.noraw">
<span class="sig-prename descclassname"><span class="pre">curses.</span></span><span class="sig-name descname"><span class="pre">noraw</span></span><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#curses.noraw" title="Link to this definition">¶</a></dt>
<dd><p>Leave raw mode. Return to normal "cooked" mode with line buffering.</p>
</dd></dl>
<dl class="py function">
<dt class="sig sig-object py" id="curses.pair_content">
<span class="sig-prename descclassname"><span class="pre">curses.</span></span><span class="sig-name descname"><span class="pre">pair_content</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">pair_number</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#curses.pair_content" title="Link to this definition">¶</a></dt>
<dd><p>Return a tuple <code class="docutils literal notranslate"><span class="pre">(fg,</span> <span class="pre">bg)</span></code> containing the colors for the requested color pair.
The value of <em>pair_number</em> must be between <code class="docutils literal notranslate"><span class="pre">0</span></code> and <code class="docutils literal notranslate"><span class="pre">COLOR_PAIRS</span> <span class="pre">-</span> <span class="pre">1</span></code>.</p>
</dd></dl>
<dl class="py function">
<dt class="sig sig-object py" id="curses.pair_number">
<span class="sig-prename descclassname"><span class="pre">curses.</span></span><span class="sig-name descname"><span class="pre">pair_number</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">attr</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#curses.pair_number" title="Link to this definition">¶</a></dt>
<dd><p>Return the number of the color-pair set by the attribute value <em>attr</em>.
<a class="reference internal" href="#curses.color_pair" title="curses.color_pair"><code class="xref py py-func docutils literal notranslate"><span class="pre">color_pair()</span></code></a> is the counterpart to this function.</p>
</dd></dl>
<dl class="py function">
<dt class="sig sig-object py" id="curses.putp">
<span class="sig-prename descclassname"><span class="pre">curses.</span></span><span class="sig-name descname"><span class="pre">putp</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">str</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#curses.putp" title="Link to this definition">¶</a></dt>
<dd><p>Equivalent to <code class="docutils literal notranslate"><span class="pre">tputs(str,</span> <span class="pre">1,</span> <span class="pre">putchar)</span></code>; emit the value of a specified
terminfo capability for the current terminal. Note that the output of <code class="xref py py-func docutils literal notranslate"><span class="pre">putp()</span></code>
always goes to standard output.</p>
</dd></dl>
<dl class="py function">
<dt class="sig sig-object py" id="curses.qiflush">
<span class="sig-prename descclassname"><span class="pre">curses.</span></span><span class="sig-name descname"><span class="pre">qiflush</span></span><span class="sig-paren">(</span><span class="optional">[</span><em class="sig-param"><span class="n"><span class="pre">flag</span></span></em><span class="optional">]</span><span class="sig-paren">)</span><a class="headerlink" href="#curses.qiflush" title="Link to this definition">¶</a></dt>
<dd><p>If <em>flag</em> is <code class="docutils literal notranslate"><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 notranslate"><span class="pre">noqiflush()</span></code></a>. If
<em>flag</em> is <code class="docutils literal notranslate"><span class="pre">True</span></code>, or no argument is provided, the queues will be flushed when
these control characters are read.</p>
</dd></dl>
<dl class="py function">
<dt class="sig sig-object py" id="curses.raw">
<span class="sig-prename descclassname"><span class="pre">curses.</span></span><span class="sig-name descname"><span class="pre">raw</span></span><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#curses.raw" title="Link to this definition">¶</a></dt>
<dd><p>Enter raw mode. In raw mode, normal line buffering and processing of
interrupt, quit, suspend, and flow control keys are turned off; characters are
presented to curses input functions one by one.</p>
</dd></dl>
<dl class="py function">
<dt class="sig sig-object py" id="curses.reset_prog_mode">
<span class="sig-prename descclassname"><span class="pre">curses.</span></span><span class="sig-name descname"><span class="pre">reset_prog_mode</span></span><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#curses.reset_prog_mode" title="Link to this definition">¶</a></dt>
<dd><p>Restore the terminal to "program" mode, as previously saved by
<a class="reference internal" href="#curses.def_prog_mode" title="curses.def_prog_mode"><code class="xref py py-func docutils literal notranslate"><span class="pre">def_prog_mode()</span></code></a>.</p>
</dd></dl>
<dl class="py function">
<dt class="sig sig-object py" id="curses.reset_shell_mode">
<span class="sig-prename descclassname"><span class="pre">curses.</span></span><span class="sig-name descname"><span class="pre">reset_shell_mode</span></span><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#curses.reset_shell_mode" title="Link to this definition">¶</a></dt>
<dd><p>Restore the terminal to "shell" mode, as previously saved by
<a class="reference internal" href="#curses.def_shell_mode" title="curses.def_shell_mode"><code class="xref py py-func docutils literal notranslate"><span class="pre">def_shell_mode()</span></code></a>.</p>
</dd></dl>
<dl class="py function">
<dt class="sig sig-object py" id="curses.resetty">
<span class="sig-prename descclassname"><span class="pre">curses.</span></span><span class="sig-name descname"><span class="pre">resetty</span></span><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#curses.resetty" title="Link to this definition">¶</a></dt>
<dd><p>Restore the state of the terminal modes to what it was at the last call to
<a class="reference internal" href="#curses.savetty" title="curses.savetty"><code class="xref py py-func docutils literal notranslate"><span class="pre">savetty()</span></code></a>.</p>
</dd></dl>
<dl class="py function">
<dt class="sig sig-object py" id="curses.resize_term">
<span class="sig-prename descclassname"><span class="pre">curses.</span></span><span class="sig-name descname"><span class="pre">resize_term</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">nlines</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">ncols</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#curses.resize_term" title="Link to this definition">¶</a></dt>
<dd><p>Backend function used by <a class="reference internal" href="#curses.resizeterm" title="curses.resizeterm"><code class="xref py py-func docutils literal notranslate"><span class="pre">resizeterm()</span></code></a>, performing most of the work;
when resizing the windows, <code class="xref py py-func docutils literal notranslate"><span class="pre">resize_term()</span></code> blank-fills the areas that are
extended. The calling application should fill in these areas with
appropriate data. The <code class="xref py py-func docutils literal notranslate"><span class="pre">resize_term()</span></code> function attempts to resize all
windows. However, due to the calling convention of pads, it is not possible
to resize these without additional interaction with the application.</p>
</dd></dl>
<dl class="py function">
<dt class="sig sig-object py" id="curses.resizeterm">
<span class="sig-prename descclassname"><span class="pre">curses.</span></span><span class="sig-name descname"><span class="pre">resizeterm</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">nlines</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">ncols</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#curses.resizeterm" title="Link to this definition">¶</a></dt>
<dd><p>Resize the standard and current windows to the specified dimensions, and
adjusts other bookkeeping data used by the curses library that record the
window dimensions (in particular the SIGWINCH handler).</p>
</dd></dl>
<dl class="py function">
<dt class="sig sig-object py" id="curses.savetty">
<span class="sig-prename descclassname"><span class="pre">curses.</span></span><span class="sig-name descname"><span class="pre">savetty</span></span><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#curses.savetty" title="Link to this definition">¶</a></dt>
<dd><p>Save the current state of the terminal modes in a buffer, usable by
<a class="reference internal" href="#curses.resetty" title="curses.resetty"><code class="xref py py-func docutils literal notranslate"><span class="pre">resetty()</span></code></a>.</p>
</dd></dl>
<dl class="py function">
<dt class="sig sig-object py" id="curses.get_escdelay">
<span class="sig-prename descclassname"><span class="pre">curses.</span></span><span class="sig-name descname"><span class="pre">get_escdelay</span></span><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#curses.get_escdelay" title="Link to this definition">¶</a></dt>
<dd><p>Retrieves the value set by <a class="reference internal" href="#curses.set_escdelay" title="curses.set_escdelay"><code class="xref py py-func docutils literal notranslate"><span class="pre">set_escdelay()</span></code></a>.</p>
<div class="versionadded">
<p><span class="versionmodified added">Added in version 3.9.</span></p>
</div>
</dd></dl>
<dl class="py function">
<dt class="sig sig-object py" id="curses.set_escdelay">
<span class="sig-prename descclassname"><span class="pre">curses.</span></span><span class="sig-name descname"><span class="pre">set_escdelay</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">ms</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#curses.set_escdelay" title="Link to this definition">¶</a></dt>
<dd><p>Sets the number of milliseconds to wait after reading an escape character,
to distinguish between an individual escape character entered on the
keyboard from escape sequences sent by cursor and function keys.</p>
<div class="versionadded">
<p><span class="versionmodified added">Added in version 3.9.</span></p>
</div>
</dd></dl>
<dl class="py function">
<dt class="sig sig-object py" id="curses.get_tabsize">
<span class="sig-prename descclassname"><span class="pre">curses.</span></span><span class="sig-name descname"><span class="pre">get_tabsize</span></span><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#curses.get_tabsize" title="Link to this definition">¶</a></dt>
<dd><p>Retrieves the value set by <a class="reference internal" href="#curses.set_tabsize" title="curses.set_tabsize"><code class="xref py py-func docutils literal notranslate"><span class="pre">set_tabsize()</span></code></a>.</p>
<div class="versionadded">
<p><span class="versionmodified added">Added in version 3.9.</span></p>
</div>
</dd></dl>
<dl class="py function">
<dt class="sig sig-object py" id="curses.set_tabsize">
<span class="sig-prename descclassname"><span class="pre">curses.</span></span><span class="sig-name descname"><span class="pre">set_tabsize</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">size</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#curses.set_tabsize" title="Link to this definition">¶</a></dt>
<dd><p>Sets the number of columns used by the curses library when converting a tab
character to spaces as it adds the tab to a window.</p>
<div class="versionadded">
<p><span class="versionmodified added">Added in version 3.9.</span></p>
</div>
</dd></dl>
<dl class="py function">
<dt class="sig sig-object py" id="curses.setsyx">
<span class="sig-prename descclassname"><span class="pre">curses.</span></span><span class="sig-name descname"><span class="pre">setsyx</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">y</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">x</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#curses.setsyx" title="Link to this definition">¶</a></dt>
<dd><p>Set the virtual screen cursor to <em>y</em>, <em>x</em>. If <em>y</em> and <em>x</em> are both <code class="docutils literal notranslate"><span class="pre">-1</span></code>, then
<a class="reference internal" href="#curses.window.leaveok" title="curses.window.leaveok"><code class="xref py py-meth docutils literal notranslate"><span class="pre">leaveok</span></code></a> is set <code class="docutils literal notranslate"><span class="pre">True</span></code>.</p>
</dd></dl>
<dl class="py function">
<dt class="sig sig-object py" id="curses.setupterm">
<span class="sig-prename descclassname"><span class="pre">curses.</span></span><span class="sig-name descname"><span class="pre">setupterm</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">term</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">None</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">fd</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">-1</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#curses.setupterm" title="Link to this definition">¶</a></dt>
<dd><p>Initialize the terminal. <em>term</em> is a string giving
the terminal name, or <code class="docutils literal notranslate"><span class="pre">None</span></code>; if omitted or <code class="docutils literal notranslate"><span class="pre">None</span></code>, the value of the
<span class="target" id="index-1"></span><code class="xref std std-envvar docutils literal notranslate"><span class="pre">TERM</span></code> environment variable will be used. <em>fd</em> is the
file descriptor to which any initialization sequences will be sent; if not
supplied or <code class="docutils literal notranslate"><span class="pre">-1</span></code>, the file descriptor for <code class="docutils literal notranslate"><span class="pre">sys.stdout</span></code> will be used.</p>
</dd></dl>
<dl class="py function">
<dt class="sig sig-object py" id="curses.start_color">
<span class="sig-prename descclassname"><span class="pre">curses.</span></span><span class="sig-name descname"><span class="pre">start_color</span></span><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#curses.start_color" title="Link to this definition">¶</a></dt>
<dd><p>Must be called if the programmer wants to use colors, and before any other color
manipulation routine is called. It is good practice to call this routine right
after <a class="reference internal" href="#curses.initscr" title="curses.initscr"><code class="xref py py-func docutils literal notranslate"><span class="pre">initscr()</span></code></a>.</p>
<p><code class="xref py py-func docutils literal notranslate"><span class="pre">start_color()</span></code> initializes eight basic colors (black, red, green, yellow,
blue, magenta, cyan, and white), and two global variables in the <code class="xref py py-mod docutils literal notranslate"><span class="pre">curses</span></code>
module, <a class="reference internal" href="#curses.COLORS" title="curses.COLORS"><code class="xref py py-const docutils literal notranslate"><span class="pre">COLORS</span></code></a> and <a class="reference internal" href="#curses.COLOR_PAIRS" title="curses.COLOR_PAIRS"><code class="xref py py-const docutils literal notranslate"><span class="pre">COLOR_PAIRS</span></code></a>, containing the maximum number
of colors and color-pairs the terminal can support. It also restores the colors
on the terminal to the values they had when the terminal was just turned on.</p>
</dd></dl>
<dl class="py function">
<dt class="sig sig-object py" id="curses.termattrs">
<span class="sig-prename descclassname"><span class="pre">curses.</span></span><span class="sig-name descname"><span class="pre">termattrs</span></span><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#curses.termattrs" title="Link to this definition">¶</a></dt>
<dd><p>Return a logical OR of all video attributes supported by the terminal. This
information is useful when a curses program needs complete control over the
appearance of the screen.</p>
</dd></dl>
<dl class="py function">
<dt class="sig sig-object py" id="curses.termname">
<span class="sig-prename descclassname"><span class="pre">curses.</span></span><span class="sig-name descname"><span class="pre">termname</span></span><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#curses.termname" title="Link to this definition">¶</a></dt>
<dd><p>Return the value of the environment variable <span class="target" id="index-2"></span><code class="xref std std-envvar docutils literal notranslate"><span class="pre">TERM</span></code>, as a bytes object,
truncated to 14 characters.</p>
</dd></dl>
<dl class="py function">
<dt class="sig sig-object py" id="curses.tigetflag">
<span class="sig-prename descclassname"><span class="pre">curses.</span></span><span class="sig-name descname"><span class="pre">tigetflag</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">capname</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#curses.tigetflag" title="Link to this definition">¶</a></dt>
<dd><p>Return the value of the Boolean capability corresponding to the terminfo
capability name <em>capname</em> as an integer. Return the value <code class="docutils literal notranslate"><span class="pre">-1</span></code> if <em>capname</em> is not a
Boolean capability, or <code class="docutils literal notranslate"><span class="pre">0</span></code> if it is canceled or absent from the terminal
description.</p>
</dd></dl>
<dl class="py function">
<dt class="sig sig-object py" id="curses.tigetnum">
<span class="sig-prename descclassname"><span class="pre">curses.</span></span><span class="sig-name descname"><span class="pre">tigetnum</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">capname</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#curses.tigetnum" title="Link to this definition">¶</a></dt>
<dd><p>Return the value of the numeric capability corresponding to the terminfo
capability name <em>capname</em> as an integer. Return the value <code class="docutils literal notranslate"><span class="pre">-2</span></code> if <em>capname</em> is not a
numeric capability, or <code class="docutils literal notranslate"><span class="pre">-1</span></code> if it is canceled or absent from the terminal
description.</p>
</dd></dl>
<dl class="py function">
<dt class="sig sig-object py" id="curses.tigetstr">
<span class="sig-prename descclassname"><span class="pre">curses.</span></span><span class="sig-name descname"><span class="pre">tigetstr</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">capname</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#curses.tigetstr" title="Link to this definition">¶</a></dt>
<dd><p>Return the value of the string capability corresponding to the terminfo
capability name <em>capname</em> as a bytes object. Return <code class="docutils literal notranslate"><span class="pre">None</span></code> if <em>capname</em>
is not a terminfo "string capability", or is canceled or absent from the
terminal description.</p>
</dd></dl>
<dl class="py function">
<dt class="sig sig-object py" id="curses.tparm">
<span class="sig-prename descclassname"><span class="pre">curses.</span></span><span class="sig-name descname"><span class="pre">tparm</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">str</span></span></em><span class="optional">[</span>, <em class="sig-param"><span class="n"><span class="pre">...</span></span></em><span class="optional">]</span><span class="sig-paren">)</span><a class="headerlink" href="#curses.tparm" title="Link to this definition">¶</a></dt>
<dd><p>Instantiate the bytes object <em>str</em> with the supplied parameters, where <em>str</em> should
be a parameterized string obtained from the terminfo database. E.g.
<code class="docutils literal notranslate"><span class="pre">tparm(tigetstr("cup"),</span> <span class="pre">5,</span> <span class="pre">3)</span></code> could result in <code class="docutils literal notranslate"><span class="pre">b'\033[6;4H'</span></code>, the exact
result depending on terminal type.</p>
</dd></dl>
<dl class="py function">
<dt class="sig sig-object py" id="curses.typeahead">
<span class="sig-prename descclassname"><span class="pre">curses.</span></span><span class="sig-name descname"><span class="pre">typeahead</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">fd</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#curses.typeahead" title="Link to this definition">¶</a></dt>
<dd><p>Specify that the file descriptor <em>fd</em> be used for typeahead checking. If <em>fd</em>
is <code class="docutils literal notranslate"><span class="pre">-1</span></code>, then no typeahead checking is done.</p>
<p>The curses library does "line-breakout optimization" by looking for typeahead
periodically while updating the screen. If input is found, and it is coming
from a tty, the current update is postponed until refresh or doupdate is called
again, allowing faster response to commands typed in advance. This function
allows specifying a different file descriptor for typeahead checking.</p>
</dd></dl>
<dl class="py function">
<dt class="sig sig-object py" id="curses.unctrl">
<span class="sig-prename descclassname"><span class="pre">curses.</span></span><span class="sig-name descname"><span class="pre">unctrl</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">ch</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#curses.unctrl" title="Link to this definition">¶</a></dt>
<dd><p>Return a bytes object which is a printable representation of the character <em>ch</em>.
Control characters are represented as a caret followed by the character, for
example as <code class="docutils literal notranslate"><span class="pre">b'^C'</span></code>. Printing characters are left as they are.</p>
</dd></dl>
<dl class="py function">
<dt class="sig sig-object py" id="curses.ungetch">
<span class="sig-prename descclassname"><span class="pre">curses.</span></span><span class="sig-name descname"><span class="pre">ungetch</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">ch</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#curses.ungetch" title="Link to this definition">¶</a></dt>
<dd><p>Push <em>ch</em> so the next <a class="reference internal" href="#curses.window.getch" title="curses.window.getch"><code class="xref py py-meth docutils literal notranslate"><span class="pre">getch()</span></code></a> will return it.</p>
<div class="admonition note">
<p class="admonition-title">توجه</p>
<p>Only one <em>ch</em> can be pushed before <code class="xref py py-meth docutils literal notranslate"><span class="pre">getch()</span></code> is called.</p>
</div>
</dd></dl>
<dl class="py function">
<dt class="sig sig-object py" id="curses.update_lines_cols">
<span class="sig-prename descclassname"><span class="pre">curses.</span></span><span class="sig-name descname"><span class="pre">update_lines_cols</span></span><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#curses.update_lines_cols" title="Link to this definition">¶</a></dt>
<dd><p>Update the <a class="reference internal" href="#curses.LINES" title="curses.LINES"><code class="xref py py-const docutils literal notranslate"><span class="pre">LINES</span></code></a> and <a class="reference internal" href="#curses.COLS" title="curses.COLS"><code class="xref py py-const docutils literal notranslate"><span class="pre">COLS</span></code></a> module variables.
Useful for detecting manual screen resize.</p>
<div class="versionadded">
<p><span class="versionmodified added">Added in version 3.5.</span></p>
</div>
</dd></dl>
<dl class="py function">
<dt class="sig sig-object py" id="curses.unget_wch">
<span class="sig-prename descclassname"><span class="pre">curses.</span></span><span class="sig-name descname"><span class="pre">unget_wch</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">ch</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#curses.unget_wch" title="Link to this definition">¶</a></dt>
<dd><p>Push <em>ch</em> so the next <a class="reference internal" href="#curses.window.get_wch" title="curses.window.get_wch"><code class="xref py py-meth docutils literal notranslate"><span class="pre">get_wch()</span></code></a> will return it.</p>
<div class="admonition note">
<p class="admonition-title">توجه</p>
<p>Only one <em>ch</em> can be pushed before <code class="xref py py-meth docutils literal notranslate"><span class="pre">get_wch()</span></code> is called.</p>
</div>
<div class="versionadded">
<p><span class="versionmodified added">Added in version 3.3.</span></p>
</div>
</dd></dl>
<dl class="py function">
<dt class="sig sig-object py" id="curses.ungetmouse">
<span class="sig-prename descclassname"><span class="pre">curses.</span></span><span class="sig-name descname"><span class="pre">ungetmouse</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">id</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">x</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">y</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">z</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">bstate</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#curses.ungetmouse" title="Link to this definition">¶</a></dt>
<dd><p>Push a <a class="reference internal" href="#curses.KEY_MOUSE" title="curses.KEY_MOUSE"><code class="xref py py-const docutils literal notranslate"><span class="pre">KEY_MOUSE</span></code></a> event onto the input queue, associating the given
state data with it.</p>
</dd></dl>
<dl class="py function">
<dt class="sig sig-object py" id="curses.use_env">
<span class="sig-prename descclassname"><span class="pre">curses.</span></span><span class="sig-name descname"><span class="pre">use_env</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">flag</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#curses.use_env" title="Link to this definition">¶</a></dt>
<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 notranslate"><span class="pre">initscr()</span></code></a> or newterm are
called. When <em>flag</em> is <code class="docutils literal notranslate"><span class="pre">False</span></code>, the values of lines and columns specified in the
terminfo database will be used, even if environment variables <span class="target" id="index-3"></span><code class="xref std std-envvar docutils literal notranslate"><span class="pre">LINES</span></code>
and <span class="target" id="index-4"></span><code class="xref std std-envvar docutils literal notranslate"><span class="pre">COLUMNS</span></code> (used by default) are set, or if curses is running in a
window (in which case default behavior would be to use the window size if
<span class="target" id="index-5"></span><code class="xref std std-envvar docutils literal notranslate"><span class="pre">LINES</span></code> and <span class="target" id="index-6"></span><code class="xref std std-envvar docutils literal notranslate"><span class="pre">COLUMNS</span></code> are not set).</p>
</dd></dl>
<dl class="py function">
<dt class="sig sig-object py" id="curses.use_default_colors">
<span class="sig-prename descclassname"><span class="pre">curses.</span></span><span class="sig-name descname"><span class="pre">use_default_colors</span></span><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#curses.use_default_colors" title="Link to this definition">¶</a></dt>
<dd><p>Equivalent to <code class="docutils literal notranslate"><span class="pre">assume_default_colors(-1,</span> <span class="pre">-1)</span></code>.</p>