Table Of Contents
SVG¶
New in version 1.9.0.
Warning
This is highly experimental and subject to change. Don’t use it in production.
Load an SVG as a graphics instruction:
from kivy.graphics.svg import Svg
with widget.canvas:
svg = Svg("image.svg")
There is no widget that can display Svg directly, you have to make your own for now. Check the examples/svg for more information.
- class kivy.graphics.svg.Svg(source=None, anchor_x=0, anchor_y=0, bezier_points=64, circle_points=64, color=None)¶
Bases:
kivy.graphics.instructions.RenderContext
- anchor_x¶
Horizontal anchor position for scaling and rotations. Defaults to 0. The symbolic values ‘left’, ‘center’ and ‘right’ are also accepted.
- anchor_y¶
Vertical anchor position for scaling and rotations. Defaults to 0. The symbolic values ‘bottom’, ‘center’ and ‘top’ are also accepted.
- color¶
The default color
Used for SvgElements that specify “currentColor”
Changed in version 1.10.3: The color is gettable and settable
New in version 1.9.1.
- current_color¶
current_color: object
- gradients¶
gradients: object
- height¶
height: ‘double’
- set_tree(self, tree)¶
sets the tree used to render the Svg and triggers reloading.
- Parameters:
tree (xml.etree.cElementTree) – the tree parsed from the SVG source
New in version 2.0.0.
- source¶
Filename / source to load.
The parsing and rendering is done as soon as you set the source.
Changed in version 2.0.0: The property name is now source instead of filename
Changed in version 1.10.3: You can get the used filename
- width¶
width: ‘double’