GithubHelp home page GithubHelp logo

canvas2svg's Introduction

Tkinter canvas to SVG exporter

Added on:1.12.2006
Update:2013-07-23 --- support for "raw" smoothed lines (contributed by Marc Culler, author of plink)
Update:2011-02-20 --- python3 compatibility
Update:2011-01-25 --- update saveall: use list of items to export
Update:2008-11-08 --- added tounicode, optional argument

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.

Public functions

convert(document, canvas, items=None, tounicode=None)

  • document --- SVG document, object that support DOM, i.e. provides createElement method etc. (function SVGdocument can be used to get such object)
  • canvas --- Tkinter.Canvas object
  • items --- list of objects to convert; if None then all items are converted
  • tounicode --- user function that should return proper unicode string if Tkinter app use other then ASCII encoding. By default tounicode = lambda text: unicode(text).encode('utf-8'). Thanks to Jan Böcker who provided solution.

SVGdocument

Takes no arguments, returns SVG document; class provided in standard xml.dom.minidom module is used.

saveall(filename, canvas, items=None, margin=10, tounicode=None)

Helper function: saves whole canvas or selected items in SVG file, sets proper dimensions, and viewport; additional margin can be set.

License & Author

canvas2svg's People

Contributors

wojciechmula avatar felix-eku avatar wil93 avatar thomashickman avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.