Is Python good for graphics?

E

Esmail Bonakdarian

First of all, I *really* like Python ;-)

I need some help with the graphical side of things. I would like to do
some basic graphics with Python, but I am not sure what the best/most
effective way for me to do what I want.

Basically, I would like to be able to create some basic animations
where I can help visualize various sorting algorithms (for instance
http://ciips.ee.uwa.edu.au/~morris/Year2/PLDS210/sorting.html#insert_anim)
or graph searches (coloring nodes as each gets visited). (Something
like this: http://cs.smith.edu/~thiebaut/java/graph/Welcome.html)

Or to create and manipulate programmatically a simple 2-D block puzzle
(like this: http://www.johnrausch.com/SlidingBlockPuzzles/quzzle.htm).

Note, the ability to do this via the web would be nice, but definitely
is *not* required at the moment.

These would be used to help in learning/teaching.

I am aware of Tkinter and wxPython (by aware I mean I know of their
existence :) Before investing (a lot?) of time to learn these, I
thought I’d ask the more experienced folks around here what would be
the best way to invest my time to get basic graphics going.

I really am not concerned so much with efficiency as easy of use.

Can anyone recommend what would suit my rather limited needs best?
Are there other graphics libraries I should consider that would be
more suitable?

Or is Python not the way to go for this?

Thanks!

Esmail
 
F

Fredrik Lundh

Esmail said:
Basically, I would like to be able to create some basic animations
where I can help visualize various sorting algorithms (for instance
http://ciips.ee.uwa.edu.au/~morris/Year2/PLDS210/sorting.html#insert_anim)
or graph searches (coloring nodes as each gets visited). (Something
like this: http://cs.smith.edu/~thiebaut/java/graph/Welcome.html)

Or to create and manipulate programmatically a simple 2-D block puzzle
(like this: http://www.johnrausch.com/SlidingBlockPuzzles/quzzle.htm).

how about:

http://vpython.org/

</F>
 
R

Robert Kern

Esmail said:
hi,

thanks, I didn't know about that.

do you (or anyone else) have a recommendation for 2D type
graphics?

I like Kiva (but then, I also help develop it). The best place to get it
right now is the SVN repository, but it's fairly stable.

http://svn.enthought.com/svn/enthought/branches/converge/kiva/

--
Robert Kern
(e-mail address removed)

"In the fields of hell where the grass grows high
Are the graves of dreams allowed to die."
-- Richard Harter
 
D

Doug Holton

Esmail said:
First of all, I *really* like Python ;-)

I need some help with the graphical side of things. I would like to do
some basic graphics with Python, but I am not sure what the best/most
effective way for me to do what I want.

Basically, I would like to be able to create some basic animations
where I can help visualize various sorting algorithms (for instance
http://ciips.ee.uwa.edu.au/~morris/Year2/PLDS210/sorting.html#insert_anim)
or graph searches (coloring nodes as each gets visited). (Something
like this: http://cs.smith.edu/~thiebaut/java/graph/Welcome.html)

Or to create and manipulate programmatically a simple 2-D block puzzle
(like this: http://www.johnrausch.com/SlidingBlockPuzzles/quzzle.htm).

Note, the ability to do this via the web would be nice, but definitely
is *not* required at the moment.

I'll tell you know it's not going to be so easy. There isn't something
in python like flash. But here are some options:

See pyxel for python: http://bellsouthpwp.net/p/r/prochak/pyxel.html
and pygame: http://pygame.org/
Gato, the graph animation toolkit, is implemented in python and tkinter:
http://www.zpr.uni-koeln.de/~gato/

You know you can use java with python, too. It's called jython. You
could use jython to interface the open source physics toolkit, for
example: http://www.opensourcephysics.org/
See also the Jython Environment for Students (JES). A book about it is
supposed to be published tomorrow actually.

And you can use a python-like language for .NET called boo with the
Piccolo.NET structured graphics toolkit: http://www.cs.umd.edu/hcil/jazz/
or these graph drawing toolkits: http://netron.sourceforge.net/ewiki/
http://www.codeproject.com/cs/miscctrl/quickgraph.asp
 
F

Fredrik Lundh

Esmail said:
hi,

thanks, I didn't know about that.

do you (or anyone else) have a recommendation for 2D type
graphics?

WCK, Tk's Canvas, wxPython (do they have a canvas-style widget
available these days), any other self-respecting UI toolkit...

but if you're going to do animations, the drawing part isn't really the hard
bit -- and vpython is designed to do animations. if you want things to look
pure 2D, all you have to do is to position the lights and the camera correctly...

(does vpython support orthographic views out of the box? if it doesn't,
that shouldn't be hard to add).

</F>
 
E

Esmail Bonakdarian

Fredrik said:
WCK, Tk's Canvas, wxPython (do they have a canvas-style widget
available these days), any other self-respecting UI toolkit...

but if you're going to do animations, the drawing part isn't really the hard
bit -- and vpython is designed to do animations. if you want things to look
pure 2D, all you have to do is to position the lights and the camera correctly...

(does vpython support orthographic views out of the box? if it doesn't,
that shouldn't be hard to add).

Thanks again, I'll consider it (I need to find out about WCK, never
heard of that before either).

Esmail
 
E

Esmail Bonakdarian

Doug said:
I'll tell you know it's not going to be so easy. There isn't something
in python like flash. But here are some options:

See pyxel for python: http://bellsouthpwp.net/p/r/prochak/pyxel.html
and pygame: http://pygame.org/
Gato, the graph animation toolkit, is implemented in python and tkinter:
http://www.zpr.uni-koeln.de/~gato/

cool, thanks for the links, I'll take a look.
You know you can use java with python, too. It's called jython. You
could use jython to interface the open source physics toolkit, for
example: http://www.opensourcephysics.org/
See also the Jython Environment for Students (JES). A book about it is
supposed to be published tomorrow actually.

And you can use a python-like language for .NET called boo with the
Piccolo.NET structured graphics toolkit: http://www.cs.umd.edu/hcil/jazz/
or these graph drawing toolkits: http://netron.sourceforge.net/ewiki/
http://www.codeproject.com/cs/miscctrl/quickgraph.asp

hmm .. more options. I guess my preference would be to stick just with
Python if possible.

regards,
Esmail
 
D

djw

Esmail said:
First of all, I *really* like Python ;-)

I need some help with the graphical side of things. I would like to do
some basic graphics with Python, but I am not sure what the best/most
effective way for me to do what I want.

Basically, I would like to be able to create some basic animations
where I can help visualize various sorting algorithms (for instance
http://ciips.ee.uwa.edu.au/~morris/Year2/PLDS210/sorting.html#insert_anim)
or graph searches (coloring nodes as each gets visited). (Something
like this: http://cs.smith.edu/~thiebaut/java/graph/Welcome.html)

Or to create and manipulate programmatically a simple 2-D block puzzle
(like this: http://www.johnrausch.com/SlidingBlockPuzzles/quzzle.htm).

Note, the ability to do this via the web would be nice, but definitely
is *not* required at the moment.

These would be used to help in learning/teaching.

I am aware of Tkinter and wxPython (by aware I mean I know of their
existence :) Before investing (a lot?) of time to learn these, I
thought I’d ask the more experienced folks around here what would be
the best way to invest my time to get basic graphics going.

I really am not concerned so much with efficiency as easy of use.

Can anyone recommend what would suit my rather limited needs best?
Are there other graphics libraries I should consider that would be
more suitable?

Or is Python not the way to go for this?

Thanks!

Esmail

PyGame?

http://www.pygame.org/
 
J

John Hunter

djw> PyGame?

djw> http://www.pygame.org/

Seconded, despite the plethora of packages proposed in response to the
original query, pygame seems like a clear winner for the problem
described.

And this coming from the author a different graphics package!

JDH
 
N

not [quite] more i squared

Esmail said:
do you (or anyone else) have a recommendation for 2D type
graphics?

A possible approach is jython that gives you access to Java2D. Makes it easy
to deploy your animated or interactive graphics as a java-compatible applet.
 
D

drewp

Esmail said:
Basically, I would like to be able to create some basic animations
where I can help visualize various sorting algorithms (for instance
http://ciips.ee.uwa.edu.au/~morris/Year2/PLDS210/sorting.html#insert_anim)
or graph searches (coloring nodes as each gets visited). (Something
like this: http://cs.smith.edu/~thiebaut/java/graph/Welcome.html)

For the sorting algorithms, at least, check out
Demo/tkinter/guido/sortvisu.py in the standard distribution.
I'd recommend Tk for all the other demos you described, too.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,767
Messages
2,569,572
Members
45,045
Latest member
DRCM

Latest Threads

Top