SNIPPET: Pipe Graphviz's graph geometry into Pmw.ScrolledCanvas

Phlip phlip_cpp at my-deja.com
Sun Feb 18 15:16:11 EST 2001


Not Hyp:

Thanks for all that help on the colorized HTML problem - this newsgroup's a 
real lifesaver, huh?

I have just finished wrapping www.graphviz.org's 'dot' language in Python. 
You define a graph (a set of nodes connected by edges) as Node objects in 
Python, and 'dot' determines how to display them asthetically with the 
edges as curves and the vertices as ovals with labels in them. /Tres/ 
cutsey.

The code looks a little bit like this:

http://freehosting1.at.webjump.com/5e5d5afd9/ph/phlip-webjump/Grapher.py.html

http://freehosting1.at.webjump.com/5e5d5afd9/ph/phlip-webjump/Grapher.py

That's off my new Web site:

        http://phlip.webjump.com

The jiggling baloney's a little heavy, but it was the first free site I 
could find that didn't already have a "phlip". Poseurs.

After Grapher.py translates the Nodes to the most primitive example of 
'dot' language, 'dot' reads this and writes either a plain text 
representation, or a PostScript file. It can probably do other formats too.

More Grapher.py code then reads the plain text representation, extracts all 
the beautiful screen coordinates from it, associates them with the Nodes 
they came from, and paints these on a Python MegaWidgets Pmw.ScrolledCanvas 
suitable for framing.

The source code illustrates Design Patterns (but I forget which ones), 
de-coupling (sort of), dictionaries, lists, and other goodies.

-- 
  Phlip                          phlip_cpp at my-deja.com
============ http://c2.com/cgi/wiki?PhlIp ============
  --  DARE to resist drug-war profiteering  --



More information about the Python-list mailing list