curses: getting cell attributes.

Brian Alexander brian094 at sympatico.ca
Sun Oct 19 01:34:01 EDT 2003


Hello;

I am trying to determine all of the cell attributes active on a given 
cell of a curses window. I start by getting a value that contains the 
attribute and character at the specified location ...

cellValue = windowHandle.inch(y, x)

Now, I have to pull out the attributes (MSB) ...

cellAttr = cellValue & 0x0000FF00

I should be able to test cellAttr for various attributes with bitwise 
AND ...

if (cellAttr & curses.A_BOLD) == curses.A_BOLD: doSomething()

Doing this doesn't seem to work. All my cells come out as having the 
same selection of attributes, curses.A_NORMAL, even though some are bold.

How do people test for active attributes in curses windows?


Many thanks,

Brian.





More information about the Python-list mailing list