如何在GimpFU中传递图像路径

2024-05-19 02:25:00 发布

您现在位置:Python中文网/ 问答频道 /正文

如何在GimpFU python中传递参数?在

#!/usr/bin/env python

from gimpfu import *
import traceback
import sys


def upload_image(img, layer, dir):
    # Actual plug-in code will go here
    try:
        open('/tmp/upload.txt', 'w+').write('img:\n')
    except:
        open('/tmp/upload_error.txt', 'w+').write(traceback.format_exc())
        open('/tmp/upload_error.txt', 'a').write(sys.exc_info()[0])

    return


register(
    "Uploader",
    "Boo",
    "Far",
    "foo",
    "bar",
    "2014",
    "<Image>/File/Upload",
  "*", 
[],
[],
    upload_image)
main()

Tags: imageimporttxtimg参数usrsyserror
1条回答
网友
1楼 · 发布于 2024-05-19 02:25:00

只需检查其他python-fu插件- 参数列表的第一个列表是指定输入参数的位置。 列表中的每个项目都是至少由4个元素组成的元组: 参数类型(例如,PF_FILE或PF_STRING,一个具有参数名的字符串, 带有参数文本描述的字符串(用作标签和工具提示), 和默认值)。在

但是PF_文件已经被破坏了一段时间,它将在GIMP 2.8.12上再次运行-在其他版本中,您不能使用PF_FILE来选择尚未退出的文件名。在

相关问题 更多 >

    热门问题