grayscale pixel based graphics with pygame

Brian L. Troutwine goofyheadedpunk at gmail.com
Wed Mar 8 21:46:32 EST 2006


I've recently begun to teach myself pygame by making a bunch of small
toys. My current toy is cellular automata displayer and I've gotten a
bit stuck on the displaying bit. (If automata isn't the plural of
automaton please forgive me.) The current automata are only binary and
are calculated using 2D Numeric arrays. It had been my assumption that
once the automata was calculated I could  then multiply the entire
array by 255 to get a nice array of grayscale pixel values. I had also
hoped to feed the new grayscale array straight into surfarray as the
manual talks in many places about 2Dpixel arrays taking integer pixel
values. But I find the tutorials and manuals confusing and usually end
up with black and blue displays. Could someone provide an explanation,
and maybe a code example, as to how to create grayscale pixel based
graphics with pygame using only 2D arrays?




More information about the Python-list mailing list