[Gimp-user] Arrays in Python



I have rarely seen a Python script use another, most people would just
copy the code they need to avoid the dependency.
That's one of Python's strongest points, though. Just import everything you
don't want to deal with yourself.
And you can factor you
code to have a class that does the work and a registration facade, so 
that other Pythin script can import you code and call the useful code 
directly.
They should already be able to call the code by running ".plugin.main()" from
the module. ....right?
*tests*
Nope. NVM. Don't have access to the image/drawable variables if called from
within another script. Will make main() a separate function instead of part of
the class. The GUI already doesn't call it directly, so it should be easy to
fix.



If you need the user to feed in several numbers on the UI, and wants
to use GIMP-FU,  (and not
design your own custom GTK UI), my suggestion is to use a string, and
tell the user to separate the nubmers by spaces
or commas  - on the Python side, you just split and convert the
argument.
https://i.imgur.com/pFCuj17.png

-- 
Beinsezii (via www.gimpusers.com/forums)


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]