Python curses question: How to separate foreground and background colors from the value returned by inch()?

pjfarley3 at earthlink.net pjfarley3 at earthlink.net
Sat Apr 3 01:25:18 EDT 2021


The window.inch(([y, x])) function returns the character and attributes of
the character at the current or specified window position. But how does one
separate the foreground and background colors from the resulting value?
colors = window.inch(0.0) & A_ATTRIBUTES
That should return the combined color + attributes value, but how to
separate the foreground and background color values from that result?
Should the following reliably work?
fg, bg = curses.pair_content (curses.pair_number(window.inch(0,0) &
A_ATTRIBUTES))
Peter


More information about the Python-list mailing list

AltStyle によって変換されたページ (->オリジナル) /