Tkinter PhotoImage Question

Ivan Van Laningham ivanlan at callware.com
Fri Nov 12 16:17:22 CET 1999


Hi All--

Fredrik Lundh wrote:
> 
> Ivan Van Laningham <ivanlan at callware.com> wrote:
> > Ok, I've managed to create an image, using xx=PhotoImage(file), and I
> > can retrieve pixel values from that image using xx.get(x,y).
> >
> > Now I want to use the put() method to write a pixel.
> >
> 
[snip]
> # tkinter wants a list of pixel lists, where each item is
> # a tk colour specification (e.g. "#120432").  map the
> # data to a list of strings, and convert the list to the
> # appropriate tuple structure
> 
> im.put( (tuple(map(lambda v: "#%02x%02x%02x" % (v, v, v), data)),) )
> 

Oh, perfect.  That's exactly the form I've got my data in already.  I
couldn't ask for anything better.

Now I get to see how Python behaves with a list with 160,000 items in
it.  (Probably no different than a list with 1, I bet.)

> # after playing with this a little, you'll love
> # the Python Imaging Library.

I already do.  But you have to start somewhere, and it might as well be
right down there at the undifferentiated quark level;-)

<everyone-should-write-an-xlib-program.-once>-ly y'rs,
Ivan

PS:  Thanks, /F!

One of the (many) nice things about this list:  After two days, I hadn't
received any replies to my question, so I *knew* it was because the
message hadn't made it through.

This is the only mailing list I'm on for which this is invariably the
case; all the others, it's quite likely that you'll be ignored for days
or weeks on end. ...
----------------------------------------------
Ivan Van Laningham
Callware Technologies, Inc.
ivanlan at callware.com
ivanlan at home.com
http://www.pauahtun.org
See also: 
http://www.foretec.com/python/workshops/1998-11/proceedings.html
Army Signal Corps:  Cu Chi, Class of '70
Author:  Teach Yourself Python in 24 Hours
----------------------------------------------




More information about the Python-list mailing list