Coder Social home page Coder Social logo

moosems / python-tksvg Goto Github PK

View Code? Open in Web Editor NEW

This project forked from rdbende/python-tksvg

0.0 0.0 0.0 349 KB

tksvg packaged for Tkinter - Use SVG images in any Tk/Tkinter application

License: Other

Shell 0.11% Python 6.93% C 89.11% CMake 3.85%

python-tksvg's Introduction

tksvg for Python's Tkinter

Build status Build Status

tksvg is a package for Tcl/Tk that adds support for SVG image files. Tkinter makes use of Tcl/Tk under the hood, and thus can benefit from this addition. Note that SVG support has been included in Tk 8.7 and thus this package can be made obsolete in the future when Python gets distributed with Tk 8.7. This repository is merely a repackaging of the tksvg library for Python with a modified build system.

Building and installation

This package makes use of the same build system as gttk and other Tcl C-extensions with CMake. This means that on both Windows and Linux you will need a working CMake installation that can find the Tcl development files. If you wish to build with Visual Studio, you can build with the build system of the upstream.

Linux

Adapt the commands to your specific distribution. The commands given here assume Ubuntu 20.04.

sudo apt install cmake build-essential tcl-dev tk-dev python3-tk
python -m pip install scikit-build
python setup.py install

Windows

Due to the rolling-release type distribution of MSYS, no up-to-date build instructions are provided in this file. Please refer to the AppVeyor build configuration in .appveyor.yml to derive the latest build instructions. Some general pointers:

  • The commands assume that you have a working MSYS2 environment. If you do not have this, you'll have to set it up to make use of the Windows build system.
  • Dependencies of the compiled binaries are detected and found using Dependencies. Make sure it is available before running the setup.py install command.
  • The AppVeyor configuration may have to work around bugs in MSYS that you might not encounter if you're using a different version. If you're confused by how the dependencies are installed, simply refer to the list found in setup.py.

Usage

Using the library has been made as similar as possible to using a normal tk.PhotoImage. Simply create an SvgImage instance and the tksvg library will automatically be loaded for you.

import tkinter as tk
import tksvg

window = tk.Tk()
svg_image = tksvg.SvgImage(file="tests/orb.svg")
label = tk.Label(image=svg_image)
label.pack()
window.mainloop()

License & Copyright

This repository merely provides a version of the original tksvg for Python's Tkinter. The package is available under the BSD-like Tcl License. The build system (setup.py, .appveyor.yml and .travis.yml) are available under the terms of GNU GPLv3, as any changes to these should be shared under permissive terms so as to preserve the possibility of building these packages.

Copyright (C) 2002-2004 Maxim Shemanarev http://antigrain.com
Copyright (c) 2013-14 Mikko Mononen [email protected]
Copyright (c) 2018 Christian Gollwitzer [email protected]
Copyright (c) 2018 Christian Werner https://www.androwish.org/
Copyright (c) 2018 Rene Zaumseil [email protected]
Copyright (c) 2020 Juliette Monsel
Copyright (c) 2021 RedFantom <[email protected]>

python-tksvg's People

Contributors

redfantom avatar oehhar avatar auriocus avatar moosems avatar apnadkarni 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.