rewrite smoother to make use of the subnormpath facilities
[PyX/mjg.git] / manual / arrows.py
blob131c2393af1659a018fdadf04d43f88203d1a045
1 #!/usr/bin/env python
2 import sys
3 sys.path[:0] = [".."]
4 from pyx import *
6 text.set(mode="latex")
7 text.preamble(r"\renewcommand{\familydefault}{\ttdefault}")
8 c = canvas.canvas()
10 # positioning is quite ugly ... but it works at the moment
11 x = 0
12 y = 0
13 dx = 6
14 dy = -0.65
15 length = 1.2
17 def drawdeco(name, showpath=0, default=0):
18 global x,y
19 p = path.path(path.moveto(x + 0.1, y+0.1 ),
20 path.rlineto(length/2.0, 0.3),
21 path.rlineto(length/2.0, -0.3))
22 c.stroke(p, [style.linewidth.THIck, eval("deco."+name)])
23 if showpath:
24 c.stroke(p, [style.linewidth.Thin, color.gray.white])
25 if default:
26 name = name + r"\rm\quad (default)"
27 c.text(x + 1.5, y + 0.15, name, [text.size.footnotesize])
28 y += dy
29 if y < -16:
30 y = 0
31 x += dx
33 drawdeco("earrow.Small")
34 drawdeco("earrow.small")
35 drawdeco("earrow.normal")
36 drawdeco("earrow.large")
37 drawdeco("earrow.Large")
39 y += dy
41 drawdeco("barrow.normal")
43 y += dy
45 drawdeco("earrow.Large([deco.filled([color.rgb.red]), style.linewidth.normal])")
46 drawdeco("earrow.normal(constriction=None)")
47 drawdeco("earrow.Large([style.linejoin.round])")
48 drawdeco("earrow.Large([deco.stroked.clear])")
50 c.writeEPSfile("arrows")
51 c.writePDFfile("arrows")