knittingtools/test/test.py

21 wiersze
571 B
Python
Czysty Zwykły widok Historia

2016-12-28 15:29:50 +00:00
# invocation: python -m test.test
from modules.pcgenerator import PCGenerator
2016-12-29 17:35:18 +00:00
import cairosvg
2016-12-28 15:29:50 +00:00
2017-02-11 18:15:02 +00:00
#pattern='--x---\n--xxxx\n-xxxx-\nxxxx--\n---x--\n'
pattern='-x\nx-\n'
2016-12-29 17:35:18 +00:00
#machine = '12-stitch-br-sr'
2017-02-11 18:15:02 +00:00
#machine = '18-stitch-mk70'
#machine = '24-stitch-br-sr'
2016-12-29 17:35:18 +00:00
machine = '40-stitch-deco'
generator = PCGenerator(None, pattern, machine, 10)
result = generator.generate()
text_file = open("{}.svg".format(machine), "w")
text_file.write(result)
text_file.close()
2016-12-29 17:35:18 +00:00
png_file = open("{}.png".format(machine), "w")
cairosvg.svg2png(bytestring=result,write_to=png_file)
png_file.close()
2017-03-04 13:47:23 +00:00