Gary venit, vidit, dixit 03/13/06 16:33:
> Alan G Isaac wrote:
>
>> What's the preferred way to put an arrowhead at the midpoint
>> of a line segment? (Like this:
>> http://en.wikipedia.org/wiki/Cobweb_Cycle )
>> Drawing it in two pieces seems the obvious choice right now,
>> but it seems like there was talk of a decoration for this?
>>
>> Thank you,
>> Alan Isaac
>>
> Similar newbie question: How to make a double-ended arrow?
> ( <--------------------> )
For that you don't need the SVN version of PyX, that's in the release
code already. The deco module defines the special decorators deco.barrow
and deco.earrow for arrows at the begin and end of the path. So, if you
want a straight line with double arrows:
from pyx import *
c = canvas.canvas()
c.stroke(path.line(0,0,3,2),[deco.barrow,deco.earrow])
c.writeEPSfile("darrow")
The beauty of the underlying concept (decorators) is that you can do
this with any paths, not just lines; and that you can add other
decorators. You can add text labels simply by adding something like
deco.text("label") to the list of decorations. In the current
development version you can have multiple arrows at arbitrary positions:
[deco.barrow,deco.arrow(0.2),deco.earrow] etc.
Cheers,
Michael
-------------------------------------------------------
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