Michael Schindler wrote:
Hello Gary,
On 14.03.06, Gary wrote:
I've looked at the example connect.py, and the docs. The way I
understand it, the bbox() method of a path will return a bbox. The
connector.arc method takes two bbox arguments. It looks like
connect.py works that way.
Then why does the following fail?
from pyx import *
c = canvas.canvas()
l1 = path.line(0,0,3,2)
c.stroke(l1)
l2 = path.line(5,5,6,6)
c.stroke(l2)
b1 = l1.bbox()
b2 = l2.bbox()
c.stroke(b1.path())
c.stroke(b2.path())
c.stroke(connector.arc(b1,b2))
c.writeEPSfile("testconnect")
In any event, it seems that either bbox() does not really return a
bbox, or connect.arc really does not take a bbox. Or both.
What's going on?
-gary
It looks like text.text.(0,0, 'hello').center is a tuple attribute, but
path.line(0,0,1,1).bbox().center is a method ... and connector chokes on it.
Are there two types of box?
Yes. One is the bbox, which is a "bounding box", always a rectangle,
consisting of horizontal and vertical lines. The other is a box, that
is a container with a center and an outline path, which is at the
moment restricted to convex piecewise straight lines. boxes are a
major design element for the (near) future of PyX. They should align
automatically to each other, should be enlarged etc. At the moment
they do the alignment of axis-labels in graphs.
For connectors, it seemed natural to take the boxes as arguments.
I must be blind. It's only now that I see the section in the docs about
the box module. And the chapter on connectors clearly says "box" and
not "bbox". My brain must have refused to see the difference between
box and bbox. Thanks for your patient reply.
Is it possible to convert a path-style bbox
into the kind of box that connector wants?
Sure. You initialise it with the coordinates from the bbox.
bb = (some bbox)
b = box.rect(bb.left(), bb.bottom(), bb.width(), bb.height())
and that's it
OK. I'm catching on slowly.
-gary
Michael.
P.S: Please be aware that the angle parameterisation of the connectors
changed from 0.8.1 to the current svn version. If you are using the
svn please consult the manual there.
-------------------------------------------------------
This SF.Net email is sponsored by xPML, a groundbreaking scripting language
that extends applications into web and mobile media. Attend the live webcast
and join the prime developer group breaking into this new coding territory!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=110944&bid=241720&dat=121642
_______________________________________________
PyX-user mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/pyx-user