How to create graphs an embed them in GUI?

A.T.Hofkamp hat at se-162.se.wtb.tue.nl
Thu Jan 17 11:07:26 EST 2008


On 2008-01-17, Heiko Niedermeyer <xena-die-kriegerprinzessin at gmx.de> wrote:
> As I'm learning Python from scratch, I don't care wether to use (=learn) 
> TKinter or PyQt or whatever, I just need some advice, which suits my 
> needs best.
> It would be nice to have the programm working under win and linux 
> (shouldn't be a big Problem) and my requirements concerning the standard 

PyGTK is a 3rd option, and wxWindows + Python is a 4th option.

TKinter is supplied with Python, which means everybody with Python also has
TKinter. Main draw-backs are that it is quite old. Also, it has a peculiar way
of getting stuff drawn at a canvas.

PyQt is available free with some additional restriction (plz read the
license) for the Linux system, I don't know whether you can also get a Win
version under the same conditions (you couldn't when I looked the last time).
PyGTK is said to be usable for both platforms. I know it works with Linux, and
there exists a PyGTK installer for Win, but I hacve never used it.

No recent experience with wxWindows.

> My problem is, that I want to add graph (simple, line connected X,Y-
> scatter plots) and if possible the 3D representation of atoms in a 
> molecule (-> coloured spheres in space).

You should probably seperate both problems, in particular if you want to have
the program do the layout for you. For 2D layout, Graphviz is one of the better
known packages, run it as a child process. There are several graphviv/dot
Python libraries available, search PyPI for them.

For 3D, I don't know any programs.

> I think it would take me years to program those by myself, so I would ne 
> ready to use packages, if available.
> Long story short: Are there packages that could do this, and does it 
> matter which GUI I want to embed them in?

If you want a GUI that understands how to layout chemical structures, you won't
have many options (on the other hand, you never know, have you tried searching
PyPI already?).

On the other hand, once you have the coordinates, drawing them is kind of
trivial in just about any GUI toolkit.

(An alternative may be to have the user lay them out by dragging them with the
mouse. Programming that is however probably a lot more work.)


Sincerely,
Albert



More information about the Python-list mailing list