File: test_layer.py

package info (click to toggle)
pyx3 0.17-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 5,328 kB
  • sloc: python: 27,656; makefile: 225; ansic: 130; sh: 17
file content (19 lines) | stat: -rw-r--r-- 769 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
import sys; sys.path.insert(0, "../..")
from pyx import *

c = canvas.canvas()

l1b = c.layer("1.b")
c.stroke(path.line(0, 0, 1, 0))
l2 = c.layer("2")
l1a = c.layer("1.a", below="1.b")

l1b.text(0.22, 0, "1b", [color.rgb.red, text.halign.center, text.vshift.mathaxis])
l2.text(0.5, 0, "2", [color.rgb.green, text.halign.center, text.vshift.mathaxis])
l1a.text(0.75, 0, "1a", [color.rgb.blue, text.halign.center, text.vshift.mathaxis])
l1a.stroke(path.line(0.25, -0.25, 0.25, 0.25), [color.rgb.blue])

c.writeEPSfile("test_layer", page_paperformat=document.paperformat.A4, page_fittosize=1)
c.writePDFfile("test_layer", page_paperformat=document.paperformat.A4, page_fittosize=1)
c.writeSVGfile("test_layer", page_paperformat=document.paperformat.A4, page_fittosize=1)