remove the gallery, it is now a wiki at https://sourceforge.net/p/pyx/gallery
[PyX.git] / manual / arrows.py
blobde50bc25b9a9402206ea207d4d349f2f287bc6eb
1 from pyx import *
3 text.set(mode="latex")
4 text.preamble(r"\renewcommand{\familydefault}{\ttdefault}")
5 c = canvas.canvas()
7 # positioning is quite ugly ... but it works at the moment
8 x = 0
9 y = 0
10 dx = 6
11 dy = -0.65
12 length = 1.2
14 def drawdeco(name, showpath=0, default=0):
15 global x,y
16 p = path.path(path.moveto(x + 0.1, y+0.1 ),
17 path.rlineto(length/2.0, 0.3),
18 path.rlineto(length/2.0, -0.3))
19 c.stroke(p, [style.linewidth.THIck, eval("deco."+name)])
20 if showpath:
21 c.stroke(p, [style.linewidth.Thin, color.gray.white])
22 if default:
23 name = name + r"\rm\quad (default)"
24 c.text(x + 1.5, y + 0.15, name, [text.size.footnotesize])
25 y += dy
26 if y < -16:
27 y = 0
28 x += dx
30 drawdeco("earrow.Small")
31 drawdeco("earrow.small")
32 drawdeco("earrow.normal")
33 drawdeco("earrow.large")
34 drawdeco("earrow.Large")
36 y += dy
38 drawdeco("barrow.normal")
40 y += dy
42 drawdeco("earrow.Large([deco.filled([color.rgb.red]), style.linewidth.normal])")
43 drawdeco("earrow.normal(constriction=None)")
44 drawdeco("earrow.Large([style.linejoin.round])")
45 drawdeco("earrow.Large([deco.stroked.clear])")
47 c.writePDFfile()