Skip to content

Commit e0f8186

Browse files
miss-islingtonserhiy-storchakaclaude
authored
[3.13] gh-87881: Document the result of curses inch() and getbkgd() (GH-152488) (GH-152511) (GH-152515)
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 ecf3713 commit e0f8186

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
@@ -955,6 +955,7 @@ Window objects
955955
.. method:: window.getbkgd()
956956

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

959960

960961
.. method:: window.getch([y, x])
@@ -1042,8 +1043,10 @@ Window objects
10421043

10431044
.. method:: window.inch([y, x])
10441045

1045-
Return the character at the given position in the window. The bottom 8 bits are
1046-
the character proper, and upper bits are the attributes.
1046+
Return the character at the given position in the window.
1047+
The bottom 8 bits are the character proper and the upper bits are the attributes;
1048+
extract them with the :data:`A_CHARTEXT` and :data:`A_ATTRIBUTES` bit-masks,
1049+
and the color pair with :func:`pair_number`.
10471050

10481051

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

0 commit comments

Comments
 (0)