Question about alpha blending and low level drawing on widgets

John Hunter jdhunter at ace.bsd.uchicago.edu
Tue Jun 29 05:34:25 CEST 2004


>>>>> "Gabriele" == Gabriele Farina *DarkBard* <Gabriele> writes:

    Gabriele> So I thought other ways: 1) using PyOpengl (tha supports
    Gabriele> alpha whe drawing primitives, supports very well zooming
    Gabriele> and gradient filling), but I think it is not a good
    Gabriele> choice because of some problems related to videocards
    Gabriele> ...  2) Use TK Canvas, but I think it does not
    Gabriele> understand alpha (am I right??) ..  3) Use QT, but I
    Gabriele> need a multiplatform application, and under windows QT
    Gabriele> are not totally free ...

matplotlib - http://matplotlib.sf.net - has a tkagg backend.  This
uses the antigrain graphics library (alpha, antialiasing, etc)
rendered on a tk canvas.  So even though tk may not support alpha, all
of the alpha blending is done in the front end by matplotlib +
antigrain, and the result is transferred onto the tk canvas.  This is
not mind numbingly fast, but may be fast enough for your purposes.

The src distribution (*.tar.gz or *.zip) comes with an example showing
how to embed matplotlib in a tk application; see
examples/embedding_in_tk.py.

matplotlib/tkagg has been tested under windows, linux, mac os X and
other unix platforms, and is distributed under a PSF style license.

Hope this helps,
John Hunter






More information about the Python-list mailing list