I'm looking for a Python library for creating canvases for manipulating geometric shapes. Specifically I need the ability to create arbitrary polygons and place them on the canvas, the polygons need to have the ability to be transparent/have an alpha channel, I need to be able to edit polygons that are currently on the canvas, and I need to be able to get the actual color of a given pixel(the aggregate of all the transparent piece that are there).
Basically I'm trying to make this: http://alteredqualia.com/visualization/evolve/ in python.
I think cairo will do a lot of what you want. They have python bindings, too.
The one requirement that that won't help you with is modifying previously-drawn polygons, but I don't know of any canvas that will do that for you.
Sounds like a job for OpenGL.
My advice is that, whichever library you choose, you make a data structure for your polygons that suits your algorithms so that they can be more simple and readable rather then try to get these algorithms to manipulate a canvas directly. Then you can write the code that draws them separate (i.e. independent) of the main logic.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With