27 Dec 2003 wspace   » (Journeyer)


I have to draw a lot of boxes and arrows diagrams, so I am currently hacking on a Python module for creating diagrams in .eps.

That is useful when you need to include it in LaTeX. There will also be SVG support, but first I want to get the design right. It has a Box, Circle (Curve), Text and some Arrow classes already, with dash, rotation and scaling support.

It is not just for drawing, but for programming such diagrams. The idea is to be able to write a program like

p = pyps.FileContents()
b1 = pyps.Box()
b2 = pyps.Box()
a = pyps.Arrow()
p.connect(b1, b2, a)
print p.epsText() 

in this example without having to specifiy coordinates at all. I am still thinking about the design for the connect method so that is not there yet. An example created with pyps is here. It was created as .eps and then translated to PNG with ghostscript (Windows install). Also shows a weakness of the Windows ghostscript: it could not find all the right fonts.

It has been a while doing such OO things, but this seems like a good case for OO. If you feel like trying it out, your comments are welcome!

Once it is mature enough, maybe there are other people who would like to join and start a project at Sourceforge.net?

Latest blog entries     Older blog entries

New Advogato Features

New HTML Parser: The long-awaited libxml2 based HTML parser code is live. It needs further work but already handles most markup better than the original parser.

Keep up with the latest Advogato features by reading the Advogato status blog.

If you're a C programmer with some spare time, take a look at the mod_virgule project page and help us with one of the tasks on the ToDo list!