Gimp-Forum.net
python scripting: image update and calling strategies - Printable Version

+- Gimp-Forum.net (https://www.gimp-forum.net)
+-- Forum: GIMP (https://www.gimp-forum.net/Forum-GIMP)
+--- Forum: Extending the GIMP (https://www.gimp-forum.net/Forum-Extending-the-GIMP)
+---- Forum: Scripting questions (https://www.gimp-forum.net/Forum-Scripting-questions)
+---- Thread: python scripting: image update and calling strategies (/Thread-python-scripting-image-update-and-calling-strategies)



python scripting: image update and calling strategies - Superkraft - 12-29-2020

I am trying to develop my first python script and i am stumbling into some questions,
i am quite stuck ....
and i am wondering whether i am searching for something which is not possible:


a) As a starting point i was trying to recreate the  Brightness-Contrast menu using the: pdb.gimp_drawable_brightness_contrast() function.

I managed to setup the UI for brightness and contrast, but:
I would like to be able to recreate the functionality of the original menu,
especially including the realtime update in my image,
which the original gimp menu is capable off, but how? is it even possible?

b) I would like to be able to create several python scripts which are able to call each other,
but i could not find a error-free way to call another python script.
For example: the first file  "contrast_filter.py" which calls after execution the second file   "levels_filter.py"


Any suggestions would be very appreciated - Thanks Wink

i will attach the python file here zipped.


RE: python scripting: image update and calling strategies - Ofnuts - 12-29-2020

a) plugins do not have access to the UI (this is conscious design decision, AFAIK), so you can't currently make a plugin that updates the layer in real time. Best you can do is update a preview in some window managed by your plugin (PyGTK).

b) If the files are in the same directory, one can import the other. If both files are Gimp plugins, both appear in the PDB, so you can call one from the other using pdb.python_fu_my_plugin_atom() if you registered the plugin as my-plugin-atom. You may want to define returned values in your plugins if you do so.