PyGObject From C
Normally when creating graphical user interfaces using GTK, 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 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.