Skip to content

Commit bdee588

Browse files
miss-islingtonserhiy-storchakaclaude
authored
[3.14] gh-87881: Document the result of curses inch() and getbkgd() (GH-152488) (GH-152511) (GH-152514)
Explain the character/attribute bit layout and how to extract the parts (A_CHARTEXT and A_ATTRIBUTES bit-masks, pair_number() for the color pair). (cherry picked from commit d831a69) (cherry picked from commit 0901331) Co-authored-by: Serhiy Storchaka <storchaka@gmail.com> Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com>
1 parent 1b967f1 commit bdee588

1 file changed

Lines changed: 5 additions & 2 deletions

File tree

Doc/library/curses.rst

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -978,6 +978,7 @@ Window objects
978978
.. method:: window.getbkgd()
979979

980980
Return the given window's current background character/attribute pair.
981+
Its components can be extracted like those of :meth:`inch`.
981982

982983

983984
.. method:: window.getch([y, x])
@@ -1068,8 +1069,10 @@ Window objects
10681069

10691070
.. method:: window.inch([y, x])
10701071

1071-
Return the character at the given position in the window. The bottom 8 bits are
1072-
the character proper, and upper bits are the attributes.
1072+
Return the character at the given position in the window.
1073+
The bottom 8 bits are the character proper and the upper bits are the attributes;
1074+
extract them with the :data:`A_CHARTEXT` and :data:`A_ATTRIBUTES` bit-masks,
1075+
and the color pair with :func:`pair_number`.
10731076

10741077

10751078
.. method:: window.insch(ch[, attr])

0 commit comments

Comments
 (0)