Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
translating every text layer
#2
Can you share an example XCF? I can't see why/how a text layer wouldn't return text.

For the modules, you can either install them in your Gimp python runtime (if you are the sole user, because it will be complicated to ask the random Gimp user to do this), or you put them in the same directory as you script file, and alter the python path  sys.path to include the path to you scripts (sys.argv[0]) before you do the import:

So you have a directory in the Gimp  plug-ins directory that bears the name of your plugin (same name as the main Python file)

Code:
importModule/
├── importModule.py
└── someModule.py

Main plugin file (importModule.py)

Code:
#! /bin/env python

import os,sys

whereIAm=os.path.dirname(sys.argv[0]) # find location of executed file

sys.path.append(whereIAm) # add to Python path
import someModule         # we can now import a module that's there

print(someModule.variable)

Imported library (someModule.py):

Code:
variable="imported OK"  # Just to check we access this OK, so module as imported OK
Reply


Messages In This Thread
translating every text layer - by jacques_duflos - 07-12-2023, 11:42 PM
RE: translating every text layer - by Ofnuts - 07-13-2023, 06:51 AM
RE: translating every text layer - by Ofnuts - 07-19-2023, 06:37 AM
RE: translating every text layer - by Ofnuts - 07-21-2023, 07:31 AM
RE: translating every text layer - by Ofnuts - 07-25-2023, 06:23 AM
RE: translating every text layer - by ttt - 10-18-2024, 09:55 PM

Forum Jump: