[Edu-sig] Elementary graphics library

Paul D. Fernhout pdfernhout at kurtz-fernhout.com
Thu Jun 1 07:19:28 CEST 2006


Thanks for these other links and comments (especially on wx).

Putting all the dozens of options together, I definitely think PyCairo 
makes a lot of sense because it has been adopted under Linux for GTK (and 
for Mozilla), so it almost certainly has a future, and would make a solid 
choice for the library of drawing my own cross-platform widgets, and would 
avoid me even wanting to write a cross-platform compatibility layer 
because I could just use it as is (which relates to the original poster's 
question, although in their case I can still see the point to a 
simplifying wrapper for education, though less so the need to have 
multiple back ends).

However, there is an ancient Chinese proverb that when confronted with 
making a decision between 100 different alternatives(*), the best choice 
is always to "Run Away!". :-)

So, along those lines, I decided to start using TK again (used in the 
first PataPata proof of concept) for several reasons including mostly it 
is the Python default. I am trying to use its widgets rather than draw my 
own, and ignore cross-platform font problems, speed issues, bitmap drawing 
issues, and so on for now. I wanted something to give me some fast 
progress on the HyperCard/widget front, and at least now I can drag TK 
buttons now under GTK 2.6 with proper feedback. Though who knows what else 
will be broken or missing -- I already had to borrow Idle's tree widget. 
:-) I am also stuck with the tk canvas for drawing (until I understand how 
PIL works? Or until PyCairo can render to a TK Canvas or Frame?) Also on 
the plus side, OpenGL should then be available through togl (though I have 
not tried that, looks like it may no longer be supported?).

Still liking wx for general stand-alone applications though. :-)

The funny thing is, since PataPata is its own Squeak-like beast, the TK 
widgets actually look kind of funky and retro in it. :-)

Amazing how much of these decisions often hinge on easy installability and 
ready availability. So, as another comment for the original poster, can TK 
as a backend meet the basic graphics operations desired?

--Paul Fernhout
(*) Or a nasty rabbit with long sharp pointy teeth.

Dethe Elza wrote:
> "The full set of Ginsu 2D interfaces for only $9.95 a month?  But
> wait, there's more..."
> Mirra
> http://www.ixi-software.net/content/body_software_mirra.html
> "Mirra is a 2D openGL python library. It defines a set of classes to
> render primitive shapes (Text, Pixel, Line, Circle, Rect, Bitmap,
> BitmaPolygon) and manages rendering and user input (mouse and
> keyboard). Mirra focuses on interaction and implements an event
> listener and classes that receive mouse events. (in a way like
> macromedia director or flash do).
> It runs using pygame(SDL) but it can also be used under wxPython.
> Mirra is also thought to teach students (basically design and
> multimedia students) programming in python by playing around with
> graphics."
> SVGDraw
> http://www2.sfk.nl/svg
> Create SVG (XML for 2D) images using Python.
>>My head is spinning. :-)
> Just wait till we delve into 3D %-)
>>Just a thought: rather than a new GUI implementation, improving the Python
>>GUI FAQ with lots of this information and pros and cons and so on might be
>>a very valuable effort just by itself.
> I think this is an excellent idea.
>>So much of choices depends on
>>specifics and tiny details. For example, I'm fairly happy with wx, but
>>there is this bug with dragging certain widgets under GTK 2.6.
> I haven't used wx for some time, but when I did it a) sucked on OS X,
> and b) seemed to be a random mix of reasonably polished widgets and
> half-baked crap that would be as useful as writing your resume in
> crayon.  It also suffers from being huge and very Windows-focused. I
> can understand using it on Windows (beats using MFC, but so does
> hitting yourself with a ball-peen hammer), but I think it goes
> downhill as you move to Linux and drops off the cliff when you go to
> OS X.  Just my impression, though I've seen the same feelings
> expressed elsewhere.  I'd sooner use PyGame, and PyGame sucks for
> general UI/event handling (by itself, there are libraries on top of
> PyGame which help).
> Of all the systems, I think PyCairo has the most momentum (and also
> has OpenGL hardware acceleration). Mozilla and GTK are both moving to
> Cairo, so it's getting lots of real-world use, profiling, bug-fixing,
> and speed-ups. This makes it a bit of a moving target, but the APIs
> should be fairly stable even though the implementation is in flux.
> Caveat emptor. I haven't spent a lot of time with any of these (on the
> Mac I can access Quartz from Python, which works for me).  I'm
> planning to explore further for an article or blog at some point, but
> any recommendations I make at this point have to be taken with a huge
> grain of salt.
> And of
>>course, I also want platform independent fonts (and I'm not sure how to
>>get those best, wx uses sizers to get platform independent dialog looks,
>>but the sizes may still vary across platforms). Maybe this 2D, 3D, and
>>Python GUI efforts needs a web site or blog or something? Some place where
>>the nitty gritty details gets hashed out? Might be one already? Kind of
>>like this one for programming languages?
>>     http://lambda-the-ultimate.org/
> Maybe just the Python Wiki?
> http://wiki.python.org/moin/
>>But specific to Python and graphics and user interaction?
>>   http://www.google.com/search?hl=en&q=python+graphics
>>Might be something to think about if it does not already exist.
>>--Paul Fernhout
> --Dethe

More information about the Edu-sig mailing list