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")

Traceback (most recent call last):
 File "<stdin>", line 17, in ?
File "c:\python24\Lib\site-packages\pyx\connector.py", line 390, in __init__
   boxdists=boxdists_pt)
File "c:\python24\Lib\site-packages\pyx\connector.py", line 117, in __init__
   rel = (self.box2.center[0] - self.box1.center[0],
TypeError: unsubscriptable object

I notice that a text instance is itself a "text.textbox", while a path is a "path.line". the bbox() method on either a text.textbox or a path.line returns a "bbox.box_pt".

It seems that connector.arc will accept a text.textbox argument, but not a bbox.box_pt arg.

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? Is it possible to convert a path-style bbox into the kind of box that connector wants?

-gary


-------------------------------------------------------
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

Reply via email to