02-13-2019, 02:54 PM
(01-19-2019, 06:32 PM)Ofnuts Wrote: Try to import gi before gimpfu. However gimpfu itself requires GTK2.
* digs in the Gimp source code *
In fact you don't need gimpfu. gimpfu is just a convenience layer to build the GUI for you and manage a few things (such as saving parameters between uses, etc). You don't absolutely need it to build your Python plugin and there are lower-level imports that won't drag GTK2 in and let you use GTK3(*). I'll let you pore over the doc from the source code.
I may be able to answer a few questions, even though you are quickly leaving my comfort zone
(*) But you have to be aware that using GTK3 makes your plugin Linux-only, on other platforms you will only find a GTK2 port available with Gimp.
Thank you for this answer!!!
Today I had a bit of time to look at the documentation and the source code as well. I think it is impossible to use GTK3 code within Python-fu. While it is true that gimpfu is just a convenience layer, I've seen that gtk 2 is integrated in the gimp module (which is then imported by gimpfu, gimpplugin, ...).
I've tryed to import "gi" before "gimpfu" (or any other gimp module"), but I always got the error:
Code:
ImportError: could not import gobject (could not find _PyGObject_API object)
Later I will look at the possibility to further separate the GTK3 interface from the Python fu script. I'll let you know!