recommend a graphics library for plotting by the pixel?

Ian Kelly ian.g.kelly at gmail.com
Tue Oct 4 11:49:58 EDT 2011


On Tue, Oct 4, 2011 at 3:56 AM, Adam Funk <a24061 at ducksburg.com> wrote:
> I'd like to create a window with a "pause" button and a large plotting
> area, in which I'd like to draw a polygon, detect the pixel
> coördinates of a mouse click, and then start setting the colors of
> pixels by (x,y) coördinates.  (This is just for my own amusement, to
> play with some formulas for generating fractals using random numbers.)
>
> There seems to be a large number of different python GUI libraries,
> and I wonder if someone can recommend the easiests one to learn for
> this purpose?  (The only python graphics library I've used is PyGame,
> which I don't think is the way to go here.)

You could use wxPython.  You'll need to create a custom control and
have it paint itself by blitting from a wx.Bitmap, which you'll draw
on by using a wx.MemoryDC and then refreshing the control.

I would probably just use pygame myself.  I guess you're avoiding it
because of the requirement for a button, but there are GUI libraries
available for it, or if all you need are a couple of buttons you could
easily roll your own.

Stay away from the Tkinter Canvas widget.  It does vector graphics,
and it will be inefficient if you try to use it as a raster.

Cheers,
Ian



More information about the Python-list mailing list