Skip to content

Commit 2c674cb

Browse files
Merge branch 'main' into curses-state-getters
# Conflicts: # Doc/whatsnew/3.16.rst # Modules/clinic/_cursesmodule.c.h
2 parents 6670403 + 3cd4283 commit 2c674cb

15 files changed

Lines changed: 596 additions & 179 deletions

Doc/library/curses.rst

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,20 @@ The module :mod:`!curses` defines the following functions:
8585
.. versionadded:: 3.14
8686

8787

88+
.. function:: alloc_pair(fg, bg)
89+
90+
Allocate a color pair for foreground color *fg* and background color *bg*,
91+
and return its number. If a color pair for the same combination of colors
92+
already exists, return its number. Otherwise allocate a new color pair and
93+
return its number.
94+
95+
This function is only available if Python was built against a wide-character
96+
version of the underlying curses library with extended-color support (see
97+
:func:`has_extended_color_support`).
98+
99+
.. versionadded:: next
100+
101+
88102
.. function:: baudrate()
89103

90104
Return the output speed of the terminal in bits per second. On software
@@ -226,6 +240,19 @@ The module :mod:`!curses` defines the following functions:
226240
.. versionadded:: next
227241

228242

243+
.. function:: find_pair(fg, bg)
244+
245+
Return the number of a color pair for foreground color *fg* and background
246+
color *bg*, or ``-1`` if no color pair for this combination of colors has
247+
been allocated.
248+
249+
This function is only available if Python was built against a wide-character
250+
version of the underlying curses library with extended-color support (see
251+
:func:`has_extended_color_support`).
252+
253+
.. versionadded:: next
254+
255+
229256
.. function:: flash()
230257

231258
Flash the screen. That is, change it to reverse-video and then change it back
@@ -239,6 +266,18 @@ The module :mod:`!curses` defines the following functions:
239266
by the user and has not yet been processed by the program.
240267

241268

269+
.. function:: free_pair(pair_number)
270+
271+
Free the color pair *pair_number*, which must have been allocated by
272+
:func:`alloc_pair`. The pair must not be in use.
273+
274+
This function is only available if Python was built against a wide-character
275+
version of the underlying curses library with extended-color support (see
276+
:func:`has_extended_color_support`).
277+
278+
.. versionadded:: next
279+
280+
242281
.. function:: getmouse()
243282

244283
After :meth:`~window.getch` returns :const:`KEY_MOUSE` to signal a mouse event, this
@@ -605,6 +644,18 @@ The module :mod:`!curses` defines the following functions:
605644
presented to curses input functions one by one.
606645

607646

647+
.. function:: reset_color_pairs()
648+
649+
Discard all color-pair definitions, releasing the color pairs allocated by
650+
:func:`init_pair` and :func:`alloc_pair`.
651+
652+
This function is only available if Python was built against a wide-character
653+
version of the underlying curses library with extended-color support (see
654+
:func:`has_extended_color_support`).
655+
656+
.. versionadded:: next
657+
658+
608659
.. function:: reset_prog_mode()
609660

610661
Restore the terminal to "program" mode, as previously saved by

0 commit comments

Comments
 (0)