Thanks for taking the time to enlighten me! Things are a little clearer now, I'll have to have another play in the console
Just to pick up on a few of your points..
Any image can have more than one display showing at a time. For example, one display might be actual size while another is zoomed in. Plug-ins generally do not need to worry about more than one display (and sometimes not even that).
I understood that, I know I could have opened several display windows:gimp.Display(img)
My question was specifically about the object I was getting back. What is it? An instance of the Class "Gimp.Display"? Same when a Layer or an Image is returned from a function to my code - what am I actually dealing with?
why are the names of object methods like 'gimp.Layer' nouns?
This and the fact that some methods are spelled like this "gimp.image_list()" really puzzled me (and led to some annoyance on the consistency front). I'm too new to Python to be sure but I think the inconsistencies can be explained like this (experienced Pythoneers put me straight please!).
"Layer" is a class (hence the noun). To create an instance of that class you just refer to it:eggLayer = gimp.Layer(img,"Egg",100,100,RGB_IMAGE,100,NORMAL_MODE)
This is inconsistent, where's the verb to say we're instantiating? This inconsistency would be in Python rather than PythonFu though.
I'm used to seeing constructs like this:eggLayer = new gimp.Layer(img,"Egg",100,100,RGB_IMAGE,100,NORMAL_MODE)
or..eggLayer = gimp.Layer.instantiate(img,"Egg",100,100,RGB_IMAGE,100,NORMAL_MODE)"Explicit is better than implicit" : The Zen Of Python [PEP20]
This all ties in with my first question, hopefully when Amazon deliver the books I've ordered the answers will present themselves
You've only created one layer ("Egg copy"). After you've added it to the image, it is not possible (nor is it necessary) to add it again.
You created a third layer, which you were then able to add to the image. You then created a fourth layer, which you were then able to add to the image.
Doh. I should have realised this when I printed the ID after making a copy of my layer. It's nonsensical to try and add another layer with same ID
The creation of a layer is a separate operation from adding the layer to the image. I would guess that this was originally done so that the layer could be filled with some color or transparency before it appears on the screen, otherwise the user might see a flash of garbage graphics while the layer was being initialized. (In fact, about the only thing you can do to a layer before it has been added to an image is to use 'gimp-drawable-fill', change its name, or change its offsets.)
I think historically you could operate on a Layer without adding it to an image but that facility was removed. I can't see why - but I'm sure there must have been a good reason - I'll have to go read up.
'gimp-layer-copy' can only be used to copy layers to the same image. If you want to copy a layer to another image then use 'gimp-layer-new-from-drawable' (in Python, 'pdb.gimp_layer_new_from_drawable' or somesuch).
Thanks, that would have taken me an age to find as I was stuck on "copy layer" rather than thinking "new layer from"
I wonder if "Layer" has an in built method to do this? My instinct is telling me to avoid accessing the PDB where I can as it's probably going to be slower and I don't know how robust the PDB-PyFu interface is really is. I don't know if this thinking is flawed and being new to Python I'll admit I'm over conscious of data types.
Thanks again for taking the time to respond, it's good to be able to discuss these things as the lack of accurate/current documentation is driving me nuts!