From: darnzen on
I've written an app using the wck library (widget construction kit,
see http://www.effbot.org), in addition to the wckGraph module. What
I'd like to do, is take the output of one of my windows (happens to be
a graph), and save it as a *.png or *.gif. I was planning on using the
PIL for this. I'd like to use the code I have as is, without re-
writing all the graphic calls to use PIL methods.

WCK uses its own "pixmap" class for storing images in memory. I can't
find any documentation or class reference for pixmap and what I find
in the source is confusing.

Does anyone have any direct experience with these libraries that can
tell me that there's some super easy thing I'm missing? I'd love it if
the wck pixmap is compatible with PIL. I don't have the time to mess
with it unless I know its going to work.
From: Nobody on
On Fri, 05 Feb 2010 21:05:53 -0800, darnzen wrote:

> I've written an app using the wck library (widget construction kit,
> see http://www.effbot.org), in addition to the wckGraph module. What
> I'd like to do, is take the output of one of my windows (happens to be
> a graph), and save it as a *.png or *.gif. I was planning on using the
> PIL for this. I'd like to use the code I have as is, without re-
> writing all the graphic calls to use PIL methods.
>
> WCK uses its own "pixmap" class for storing images in memory. I can't
> find any documentation or class reference for pixmap and what I find
> in the source is confusing.

A WCK pixmap is a "draw object" whose underlying drawable is a pixmap
(i.e. a Tk pixmap, which is the platform's native "chunk of video memory"
pixmap type) rather than a window.

From the source code, WCK doesn't appear to offer any way to retrieve the
pixel data (i.e. there's no way to do the opposite of draw.paste()).

From: darnzen on
On Feb 6, 10:19 pm, Nobody <nob...(a)nowhere.com> wrote:
> On Fri, 05 Feb 2010 21:05:53 -0800, darnzen wrote:
> > I've written an app using thewcklibrary (widget construction kit,
> > seehttp://www.effbot.org), in addition to the wckGraph module. What
> > I'd like to do, is take the output of one of my windows (happens to be
> > a graph), and save it as a *.png or *.gif. I was planning on using the
> >PILfor this. I'd like to use the code I have as is, without re-
> > writing all the graphic calls to usePILmethods.
>
> >WCKuses its own "pixmap" class for storing images in memory. I can't
> > find any documentation or class reference for pixmap and what I find
> > in the source is confusing.
>
> AWCKpixmap is a "draw object" whose underlying drawable is a pixmap
> (i.e. a Tk pixmap, which is the platform's native "chunk of video memory"
> pixmap type) rather than a window.
>
> From the source code,WCKdoesn't appear to offer any way to retrieve the
> pixel data (i.e. there's no way to do the opposite of draw.paste()).

I found a description of how to use a WCK drawing interface to draw
into a PIL image. (http://effbot.org/zone/pil-draw-wck.htm) but I'm
not sure how to use that class (SimpleDraw) to allow me to use
existing WCK code. Should I use it as a "mix in" to overwrite base
methods via inheritance?

class MyClass(SimpleDraw, Widget):
pass