用svgwrite旋转路径

时间:2019-10-09 09:34:29

标签: python svg svgwrite

假设我使用svgwrite在SVG中用箭头创建了一个图形:

In [1]: import svgwrite

In [2]: dwg = svgwrite.Drawing('arrow.svg')

In [3]: path = dwg.path(d='M 0,283.45145 H 39.819792 v 13.22917 L 66.278127,270.22229 39.819793,243.76395 v 13.22917 H
   ...: 0 Z')
        dwg.add(path)

In [4]: dwg.save()

是否可以在保存之前将其旋转180°?

谢谢!

1 个答案:

答案 0 :(得分:0)

您可以在路径上添加一个变换,例如

 path = dwg.path(d='M 0,283.45145 H 39.819792 v 13.22917 L 66.278127,270.22229 39.819793,243.76395 v 13.22917 H...: 0 Z', transform="rotate(180)")