|
3 | 3 | adds support for SVG image files. Tkinter makes use of Tcl/Tk under the |
4 | 4 | hood, and thus can benefit from this addition. Note that SVG support |
5 | 5 | has been included in Tk 8.7 and thus this package can be made obsolete |
6 | | -in the future when Python gets distributed with Tk 8.7. |
| 6 | +in the future when Python gets distributed with Tk 8.7. This package is |
| 7 | +merely a repackaging of the `tksvg` library for Python with a modified |
| 8 | +build system. |
7 | 9 |
|
| 10 | +## Building and installation |
| 11 | +This package makes use of the same build system as [`gttk`](https://github.com/TkinterEP/python-gttk) |
| 12 | +and other Tcl C-extensions with CMake. This means that on both Windows |
| 13 | +and Linux you will need a working CMake installation that can find the |
| 14 | +Tcl development files. If you wish to build with Visual Studio, you can |
| 15 | +build with the build system of the [upstream](https://github.com/oehhar/tksvg). |
8 | 16 |
|
| 17 | +### Linux |
| 18 | +Adapt the commands to your specific distribution. The commands given |
| 19 | +here assume Ubuntu 20.04. |
| 20 | +```bash |
| 21 | +sudo apt install cmake build-essential tcl-dev tk-dev python3-tk |
| 22 | +python -m pip install scikit-build |
| 23 | +python setup.py install |
| 24 | +``` |
| 25 | + |
| 26 | +### Windows |
| 27 | +Due to the rolling-release type distribution of MSYS, no up-to-date |
| 28 | +build instructions are provided in this file. Please refer to the |
| 29 | +AppVeyor build configuration in `.appveyor.yml` to derive the latest |
| 30 | +build instructions. Some general pointers: |
| 31 | +- The commands assume that you have a working [MSYS2](https://www.msys2.org/) |
| 32 | + environment. If you do not have this, you'll have to set it up to make |
| 33 | + use of the Windows build system. |
| 34 | +- Dependencies of the compiled binaries are detected and found using |
| 35 | + [Dependencies](https://github.com/lucasg/Dependencies). Make sure it |
| 36 | + is available before running the `setup.py install` command. |
| 37 | +- The AppVeyor configuration may have to work around bugs in MSYS that |
| 38 | + you might not encounter if you're using a different version. If you're |
| 39 | + confused by how the dependencies are installed, simply refer to the |
| 40 | + list found in [`setup.py`](https://github.com/TkinterEP/python-tksvg/blob/02cf680bf4b9c5471d6bff1508e9705648ef18cd/setup.py#L52). |
| 41 | + |
| 42 | +## Usage |
| 43 | +Using the library has been made as similar as possible to using a normal |
| 44 | +`tk.PhotoImage`. Simply create an `SvgImage` instance and the `tksvg` |
| 45 | +library will automatically be loaded for you. |
| 46 | +```python |
| 47 | +import tkinter as tk |
| 48 | +import tksvg |
| 49 | + |
| 50 | +window = tk.Tk() |
| 51 | +svg_image = tksvg.SvgImage(file="tests/orb.svg") |
| 52 | +label = tk.Label(image=svg_image) |
| 53 | +label.pack() |
| 54 | +window.mainloop() |
| 55 | +``` |
| 56 | + |
| 57 | +## License & Copyright |
| 58 | +This repository merely provides a version of the original [tksvg](https://github.com/oehhar/tksvg) |
| 59 | +for Python's Tkinter. The package is available under the BSD-like |
| 60 | +[Tcl License](https://github.com/TkinterEP/python-tksvg/blob/master/LICENSE.md). |
| 61 | +The build system (`setup.py`, `.appveyor.yml` and `.travis.yml`) are |
| 62 | +available under the terms of [GNU GPLv3](http://www.gnu.org/licenses/gpl-3.0.en.html), |
| 63 | +as any changes to these should be shared under permissive terms so as to |
| 64 | +preserve the possibility of building these packages. |
| 65 | +``` |
| 66 | +Copyright (C) 2002-2004 Maxim Shemanarev http://antigrain.com |
| 67 | +Copyright (c) 2013-14 Mikko Mononen [email protected] |
| 68 | +Copyright (c) 2018 Christian Gollwitzer [email protected] |
| 69 | +Copyright (c) 2018 Christian Werner https://www.androwish.org/ |
| 70 | +Copyright (c) 2018 Rene Zaumseil [email protected] |
| 71 | +Copyright (c) 2020 Juliette Monsel |
| 72 | +Copyright (c) 2021 RedFantom <[email protected]> |
| 73 | +``` |
0 commit comments