Skip to content

Commit 0901331

Browse files
[3.15] gh-87881: Document the result of curses inch() and getbkgd() (GH-152488) (GH-152511)
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) Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com>
1 parent 8777a0c commit 0901331

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
@@ -975,6 +975,7 @@ Window objects
975975
.. method:: window.getbkgd()
976976

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

979980

980981
.. method:: window.getch([y, x])
@@ -1065,8 +1066,10 @@ Window objects
10651066

10661067
.. method:: window.inch([y, x])
10671068

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

10711074

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

0 commit comments

Comments
 (0)