show some aspects of the connector module
[PyX/mjg.git] / examples / connect.py
blob1295fd16a3d9ff6368b6914fcb15b596cd5f0584
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.char(0.5))
8 B = c.text(1,0, r"\bf B", text.halign.center, text.vshift.char(0.5))
9 C = c.text(1,1, r"\bf C", text.halign.center, text.vshift.char(0.5))
10 D = c.text(0,1, r"\bf D", text.halign.center, text.vshift.char(0.5))
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, canvas.earrow.normal)
19 c.stroke(connector.curve(D, B, boxdists=0.2, relangle1=45, relangle2=-45, relbulge=0.8),
20 color.rgb.blue, canvas.earrow.normal)
22 c.writetofile("connect", paperformat="a4", fittosize=1, margin="3 t cm")