grayscale pixel based graphics with pygame
Terry Reedy
tjreedy at udel.edu
Wed Mar 8 23:59:43 EST 2006
"Brian L. Troutwine" <goofyheadedpunk at gmail.com> wrote in message
news:1141872392.131004.247580 at v46g2000cwv.googlegroups.com...
> 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 presume you are simply recoding 1 as 255 to get visual contrast with 0.
Was you assumption correct?
>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.
Questions about pygame are better directed to the pygame mailing list, also
accessible as newsgroup gmane.comp.python.pygame at news.gmane.org. The
helpful folks there should also be able to answer simple graphics-related
questions on using numeric (although there is also a numeric/numpy list).
> But I find the tutorials and manuals confusing
For python, numeric, or pygame?
>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?
See pygame list. There might already be an example that you missed.
Terry Jan Reedy
More information about the Python-list
mailing list