aboutsummaryrefslogtreecommitdiff
path: root/readme.md
blob: cd78d67efb65f41817ae3289226824ecde1da97a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
# PyGObject From C

Normally when creating graphical user interfaces using [GTK](https://gtk.org),
one would choose to write their whole project in C or another programming
language for which GTK bindings exist.

For this example, we wish to use [PyGObject](https://pygobject.readthedocs.io)
to write a GTK application in Python, due to its simplicity, ubiquity, and
ablilty to do rapid ad-hoc development. However, if our application is part of
a larger user interface *not* written in Python, we need a way to bridge the
interface between Python and the host language.

This proof-of-concept bridges PyGObject and C so that one may create GTK-based
user interfaces in Python as part of a larger interface with a C interface.
It does this by extracting the raw `GObject` C-pointer from the user-defined
`PyGObject` and passes it as a `GtkWidget` to the host.

Please note that this is a proof-of-concept and may have issues with memory
management, error handling, and versioning. Whether Python or GTK is a good
fit for plugin UI development is debatable, the motivation for creating this
is for rapid ad-hoc UI creation during the development stage only, and not
intended for use in production.