Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Python-Fu Gimp 3.2.4. Get the active image
#1
Hi!

Question about Python-Fu Gimp 3.2.4

How do I get the active image (the one with focus) from all open images?
Reply
#2
(7 hours ago)Burcador Wrote: Hi!

Question about Python-Fu Gimp 3.2.4

How do I get the active image (the one with focus) from all open images?

Its automatically included into the main function arguments by the initial procedure. In this function:
Code:
def my_function(procedure, run_mode, image, drawables, config, data) :

"image" is the active image when you call the plugin.
Reply
#3
(4 hours ago)Scallact Wrote: def my_function(procedure, run_mode, image, drawables, config, data) :[/code]

"image" is the active image when you call the plugin.

No, not when the plugin is initialized.

My plugin launches a panel with buttons for launching several plugins.

While it's running, several images are open.
I'm switching between them.
The panel is open.

But how do I determine the active image so I can apply the plugin launched by the panel button to it?

The plugin only detects the active image upon startup. What about during operation?
Reply
#4
(4 hours ago)Burcador Wrote: ....snip,,,,
My plugin launches a panel with buttons for launching several plugins.

That reads like this plugin https://www.chuckhenrich.com/custom-command-panel-gimp/

It is up to the user to choose the alternative image, which then brings up the plugin dialog.

   

Maybe have a look at the code, there might be something in it that you can apply to your project.
Reply
#5
(2 hours ago)rich2005 Wrote: That reads like this plugin https://www.chuckhenrich.com/custom-command-panel-gimp/
It is up to the user to choose the alternative image, which then brings up the plugin dialog.

The plugin is excellent, thank you.
I'll use it.

However, the author also couldn't find a way to automatically detect the active image.
Instead, he suggests choosing from among the open ones to apply the plugin to, which you launch if you have multiple images.

Basically, I did it in a similar way, except I select the image before launching it.
. . .
But I'd like to find a more elegant way.
Reply


Forum Jump: