rename afm module in afmfile
[PyX/mjg.git] / gallery / misc / connect.py
blob6729738cbfeb57c18b8ab69eeab37dac72f191d0
1 from pyx import *
2 from pyx.connector import arc, curve
4 unit.set(uscale=3)
6 c = canvas.canvas()
8 textattrs = [text.halign.center, text.vshift.middlezero]
9 A = text.text(0, 0, r"\bf A", textattrs)
10 B = text.text(1, 0, r"\bf B", textattrs)
11 C = text.text(1, 1, r"\bf C", textattrs)
12 D = text.text(0, 1, r"\bf D", textattrs)
14 for X in [A, B, C, D]:
15 c.draw(X.bbox().enlarged(0.1).path(),
16 [deco.stroked(), deco.filled([color.grey(0.85)])])
17 c.insert(X)
19 for X,Y in [[A, B], [B, C], [C, D], [D, A]]:
20 c.stroke(arc(X, Y, boxdists=[0.2, 0.2], relangle=-45), [color.rgb.red, deco.earrow.normal])
22 c.stroke(curve(D, B, boxdists=[0.2, 0.2], relangle1=-45, relangle2=-45, relbulge=0.8),
23 [color.rgb.blue, deco.earrow.normal])
25 c.writeEPSfile("connect")
26 c.writePDFfile("connect")