Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Does Script-Fu support input/output of the files?
#3
Thanks for the answer!
I looked your code through and noticed that you used with open() structure to write to csv file. 
I used it in my code, but it doesn't work as I see the button in the top menu bar through which the script is called has disappeared. From what I understand, this happens when there are syntax errors in the code. 
So I tested with open() part in a separate python file and it works but it doesn't work as a part of the code below:

Code:
#!/usr/bin/env python
# -*- coding: utf-8 -*-

from gimpfu import *
import os

def foo():
  selection, x1, y1, x2, y2 = pdb.gimp_selection_bounds(gimp.image_list()[0])
  if not selection:
      pdb.gimp_message("No selection")
  else:
      with open(f'{gimp.image_list()[0].filename}.txt', 'w') as f:
          res = f'{y1}, {x1}, {y2}, {x2}'
          f.writelines(res)
register(...)
main()

Please tell me what I'm doing wrong
Reply


Messages In This Thread
RE: Does Script-Fu support input/output of the files? - by esm - 05-16-2024, 09:45 AM

Forum Jump: