-added inplace add method __iadd__ and set _nmax=max for the moment, use inplace...
[PyX/mjg.git] / examples / connect.py
blob14fc4a6392a5f5d52b9b605dc65b36da4e156f93
1 from pyx import *
3 unit.set(uscale=3)
5 c = canvas.canvas()
7 A = c.text(0, 0, r"\bf A", [text.halign.center, text.vshift.middlezero])
8 B = c.text(1, 0, r"\bf B", [text.halign.center, text.vshift.middlezero])
9 C = c.text(1, 1, r"\bf C", [text.halign.center, text.vshift.middlezero])
10 D = c.text(0, 1, r"\bf D", [text.halign.center, text.vshift.middlezero])
12 for X in [A, B, C, D]:
13 # center is in true points
14 c.stroke(path.circle(unit.t_pt(X.center[0]), unit.t_pt(X.center[1]), "0.25 t"))
16 for X,Y in [[A, B], [B, C], [C, D], [D, A]]:
17 c.stroke(connector.arc(X, Y, boxdists=0.2), [color.rgb.red, deco.earrow.normal])
19 c.stroke(connector.curve(D, B, boxdists=0.2, relangle1=45, relangle2=-45, relbulge=0.8),
20 [color.rgb.blue, deco.earrow.normal])
22 c.writetofile("connect")