I'm trying to write utility for drawing tiles, and I'm using a DrawingArea with an off-screen Pixmap similar to the "scribble" example program in the PyGTK tutorial, although I am allowing different colors. My question is if there's a simple way to change the "palette" of what you have drawn onto the DrawingArea (or really the Pixmap, as that's what is getting drawn to). The tiles in my program are limited to four colors and I let the user change which 4 colors are used (as his "palette", the way I've normally heard it called) from another limited set of colors (64 of them). What I would like to do is to update whatever they've drawn on the screen with the new colors, when he changes, but I'm having a lot of trouble figuring out a good way to do this or finding any info / examples that relate to it. Is there an easy, built-in way to do this, or if not, does anyone have a suggestion as to a good way to do this (especially nice if there's an example somewhere)?

Just to clarify, if the above isn't understandable, say the user has a palette of the colors labeled 0, 1, 2, and 3. Say there is a single line with those colors and it is represented below, with each number representing a pixel:

0 0 0 1 0 3 2 0

Now say the user changes his palette so that the color which was labeled 0 is now the color labeled 4, 1 is now 5, 2 is now 6, and 3 is now 7. I would like to make my program automatically update these changes so the line looks like this:

4 4 4 5 4 7 6 4

Is this possible with the DrawingArea / Pixmap? Thanks for any help.


--
J. A. McMahan Jr.
_______________________________________________
pygtk mailing list   pygtk@daa.com.au
http://www.daa.com.au/mailman/listinfo/pygtk
Read the PyGTK FAQ: http://www.async.com.br/faq/pygtk/

Reply via email to