Gaphas is the diagramming widget library for Python.
Gaphas is a library that provides the user interface component (widget) for drawing diagrams. Diagrams can be drawn to screen and then easily exported to a variety of formats, including SVG and PDF. Want to build an app with chart-like diagrams? Then Gaphas is for you! Use this library to build a tree, network, flowchart, or other diagrams.
This library is currently being used by Gaphor for UML drawing, RAFCON for state-machine based robot control, and ASCEND for solving mathematical models.
Gaphas was built to provide the foundational diagramming portions of Gaphor. Since Gaphor is built on GTK and Cairo, PyGObject provides access to the GUI toolkit and PyCairo to the 2D graphics library. However, there wasn't a project that abstracted these technologies to easily create a diagramming tool. Hence, Gaphas was created as a library to allow others to create a diagramming tool using GTK and Cairo.
Here is how it works:
The main portions of the library include:
Gaphas contains default implementations for Canvas
and Item
s. There are protocols in place
to allow you to make your own canvas.
To install Gaphas, simply use pip:
$ pip install gaphas
Use of a virtual environment is highly recommended.
To setup a development environment with Linux:
$ sudo apt-get install -y python3-dev python3-gi python3-gi-cairo
gir1.2-gtk-3.0 libgirepository1.0-dev libcairo2-dev
$ pip install poetry
$ poetry install
API docs and tutorials can be found on Read the Docs.
Thanks goes to these wonderful people (emoji key):
This project follows the all-contributors specification. Contributions of any kind are welcome!
Copyright Β© Arjan Molenaar and Dan Yeaw
Licensed under the Apache License 2.0.
Summary: You can do what you like with Gaphas, as long as you include the required notices. This permissive license contains a patent license from the contributors of the code.