don't use the mode argument in text.set anymore
[PyX.git] / manual / boxalign.py
blob61bc4c2536c5308600fd1d287b5e284469fcd18c
1 import math
2 from pyx import *
4 c = canvas.canvas()
5 t1 = text.text(0, 0, "circle align", [text.halign.center, text.size.huge])
6 x, y = t1.circlealignvector(1, 1, 1)
7 t1.circlealign(1, 1, 1)
8 c.stroke(path.path(path.arc(0, 0, 1, -30, 120)), [style.linestyle.dashed])
9 c.stroke(t1.path(centerradius=0.05), [style.linewidth.THin])
10 c.stroke(path.line(0, 0, x, y), [deco.earrow.normal])
11 c.insert(t1)
12 t2 = text.text(5, 0, "line align", [text.halign.center, text.size.huge])
13 x, y = t2.linealignvector(1, 1, 1)
14 t2.linealign(1, 1, 1)
15 c.stroke(path.line(5 + 1.5 * math.sqrt(2), -0.5 * math.sqrt(2), 5 - 0.5 * math.sqrt(2), 1.5 * math.sqrt(2)), [style.linestyle.dashed])
16 c.stroke(t2.path(centerradius=0.05), [style.linewidth.THin])
17 c.stroke(path.line(5, 0, 5 + x, y), [deco.earrow.normal])
18 c.insert(t2)
19 c.writePDFfile()