Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Python-fu plugin UI
#7
(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 Smile

(*) 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!!! Smile

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! Smile
Reply


Messages In This Thread
Python-fu plugin UI - by Davide_sd - 01-16-2019, 10:06 PM
RE: Python-fu plugin UI - by Ofnuts - 01-16-2019, 10:16 PM
RE: Python-fu plugin UI - by Davide_sd - 01-16-2019, 10:36 PM
RE: Python-fu plugin UI - by Ofnuts - 01-16-2019, 11:21 PM
RE: Python-fu plugin UI - by Davide_sd - 01-19-2019, 01:14 PM
RE: Python-fu plugin UI - by Ofnuts - 01-19-2019, 06:32 PM
RE: Python-fu plugin UI - by Davide_sd - 02-13-2019, 02:54 PM

Forum Jump: