Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Terminate for loop in console
#4
(07-04-2023, 03:55 PM)pwiecek56 Wrote: I'm trying to learn python scripting. I'm working in the Python-fu console

How do I terminate a loop?

example:
#############################
list = gimp.image_list()

for x in list:
      pdb.gimp_image_delete(x)for imag
list
#############################

No matter what I try, the console tries to include the next line in the loop

You just strike [enter] until you are back to the ➤➤➤ prompt:

   


But you can't delete an image that hasn't been created by the script,

   

This is because such image has a view and you cannot delete an image that has views. And you can't normally obtain a reference to an existing image view to close it (but if you create the view with a script then you have a reference to the view, so you can close it in the script).

There is an Images dockable dialog from which you can manually delete images that have no attached "view".

   
Reply


Messages In This Thread
Terminate for loop in console - by pwiecek56 - 07-04-2023, 03:55 PM
RE: Terminate for loop in console - by PixLab - 07-05-2023, 02:24 AM
RE: Terminate for loop in console - by pwiecek56 - 07-05-2023, 06:59 AM
RE: Terminate for loop in console - by Ofnuts - 07-05-2023, 07:00 PM
RE: Terminate for loop in console - by Dogarithm - 12-16-2023, 01:05 AM
RE: Terminate for loop in console - by Ofnuts - 12-16-2023, 09:40 AM
RE: Terminate for loop in console - by Ofnuts - 07-05-2023, 07:04 AM
RE: Terminate for loop in console - by pwiecek56 - 07-05-2023, 06:17 PM

Forum Jump: