Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Learn to create Python3 plugins
#8
(12-28-2021, 10:35 PM)programmer_ceds Wrote:
(12-28-2021, 07:27 PM)z-uo Wrote: Thank you for each correction! I reach to create it!
Now I find that with the following commands I have the selection bounds:
Code:
selection = image.get_selection()
flag, non_empty, x1, y1, x2, y2 = selection.bounds(image)
But how to fill that selection with the PP color (or SF color or White or any color)? Where I can find documentation for the instructions (I only found this that is for python2)?
You could use gimp-drawable-edit-fill() - with all of the functions from the GIMP PDB you can call them in the way that I called gimp-image-get-item-position() in the code fragment in my previous post - there may be neater ways to do this for some functions but, as you are finding out, the documentation is somewhat limited. In case you don't know - you can find details on all of the PDB functions in GIMP by going to "Filters/Development/Python-Fu/Python Console/Browse". Type in something related to what you are looking for (for example Layer) and you will all of the functions that contain that word.

Some of this is a bit of an uphill struggle but there is satisfaction when you find the answer :-)

Thank you! with the Browse and the python function dir(OBJ) and OBD.__dict__ I reach to complete the porting!
Now I try to do an unnecessary thing: I want that at the end a particular layer is the selected(that is the group in witch contains other two created layers created by the plugin) so I try with:
Code:
garray = Gimp.ObjectArray()
garray.data.__add__([layer_group])
Gimp.get_pdb().run_procedure('gimp-image-set-selected-layers',
                                 [image, 1, garray ])
Or simply with:
Code:
Gimp.get_pdb().run_procedure('gimp-image-set-selected-layers',
                                 [image, 1, [layer_group] ])

But it Crashes (the entire GIMP crashes).
The full code can be found here.
How can I select a specific layer by code?
Reply


Messages In This Thread
Learn to create Python3 plugins - by z-uo - 12-27-2021, 09:59 AM
RE: Learn to create Python3 plugins - by z-uo - 12-27-2021, 04:12 PM
RE: Learn to create Python3 plugins - by z-uo - 12-28-2021, 11:14 AM
RE: Learn to create Python3 plugins - by z-uo - 12-28-2021, 07:27 PM
RE: Learn to create Python3 plugins - by z-uo - 12-29-2021, 05:07 PM
RE: Learn to create Python3 plugins - by z-uo - 12-30-2021, 10:16 AM
RE: Learn to create Python3 plugins - by z-uo - 12-30-2021, 04:56 PM
RE: Learn to create Python3 plugins - by z-uo - 12-30-2021, 05:54 PM
RE: Learn to create Python3 plugins - by z-uo - 12-31-2021, 08:40 AM
RE: Learn to create Python3 plugins - by z-uo - 01-02-2022, 10:37 AM

Forum Jump: