This module provides function convert
that convert all or selected
items placed on given canvas object.
Supported items:
- lines
- lines with arrows
- polygons
- smoothed lines and polygons
- ovals (i.e. circle & ellipse)
- arcs (all kind, i.e. ARC, CHORD, PIESLICE)
- rectangles
- text (unwrapped only i.e. attribute
width = 0
)
Unsupported items:
- images
- bitmaps
- windows
Stipples are not applied.
document
--- SVG document, object that support DOM, i.e. providescreateElement
method etc. (functionSVGdocument
can be used to get such object)canvas
--- Tkinter.Canvas objectitems
--- list of objects to convert; ifNone
then all items are convertedtounicode
--- user function that should return proper unicode string if Tkinter app use other then ASCII encoding. By defaulttounicode = lambda text: unicode(text).encode('utf-8')
. Thanks to Jan Böcker who provided solution.
Takes no arguments, returns SVG document; class provided in standard
xml.dom.minidom
module is used.
Helper function: saves whole canvas or selected items in SVG file,
sets proper dimensions, and viewport; additional margin
can
be set.
Module might emit warnings. By default it use custom function which
prints message on the standard error. You can change this by calling
method canvasvg.warnings(mode)
with three possible values:
canvasvg.PYTHON
--- usewarn
from the standard modulewarnings
;canvasvg.MODULE
--- use the custom function;canvasvg.NONE
--- do not print any message.
Module might use either <path>
or <line>
tag for segment
representation. By default it uses <line>
. The behaviour could be changed
globally by calling canvasvg.configure(*flags)
with one of consequent
values:
canvasvg.SEGMENT_TO_LINE
--- use<line>
tag;canvasvg.SEGMENT_TO_PATH
--- use<path>
tag.
Below are major changes made before moving on Github.
- 2013-07-23 --- support for "raw" smoothed lines (contributed by Marc Culler, author of plink)
- 2011-02-20 --- python3 compatibility
- 2011-01-25 --- update
saveall
: use list of items to export - 2008-11-08 --- added
tounicode
, optional argument - 2006-12-01 --- initial release