Re: [Gimp-developer] Problems using the PF_STRINGARRAY parameter type when writing a Python plugin for Gimp.



On Tue, May 22, 2018 at 8:17 PM, Craig Sanders <craig sanders gimp gmail com
wrote:

Hello.

I'm trying to write a very basic plugin for Gimp using Python and I
want its one and only parameter to be of type PF_STRINGARRAY. The goal
of my plugin for the time being, is to receive a list of files, and
then simply print their names on the Command line, when the plugin is
run.


Huh. If I ever knew that PF_STRINGARRAY existed, it did not sink into the
gray matter much.

Try this, instead, perhaps.  It has the limitation of delivering all of the
files in the directory however:

Hmm, I have been doing this in two steps:

import os

def list_directory(directory):
    cennotts = os.listdir(directory)
    contents = sorted(cennotts)
    return contents

def list_directory_ext(directory, ext):
    total_contents = list_directory(directory)
    contents = []
    for content in total_contents:
    if content.endswith(ext):contents.append(content)
    return contents

They work with (PF_DIRNAME, "img_dir",   "Images directory", ""),

carol


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