2015-01-03 12 views
0

我有這個功能def enumerategrid(image, width, height, tcolor, theight, font, startfrom)瘸子 - 當前圖像不作爲參數傳遞給我的插件功能

而且有它register編輯:

gimpfu.register(
    proc_name="enumerategrid_plugin-pdb", 
    blurb="Enumera rejillas en una imagen", 
    help="Enumera rejillas en una imagen", 
    author="Jorge Araya Navarro <[email protected]>", 
    copyright="Servants of the Secret Fire Game Studios", 
    date="2015", 
    label="Enumerar rejilla...", 
    imagetypes="*", 
    params=[ 
     (gimpfu.PF_INT32, "width", "ancho de la reja", 32), 
     (gimpfu.PF_INT32, "height", "altura de la reja", 32), 
     (gimpfu.PF_COLOR, "tcolor", "Color del texto", (1.0, 1.0, 1.0)), 
     (gimpfu.PF_SPINNER, "theight", "Tamaño del texto", 8, (1, 50, 1)), 
     (gimpfu.PF_FONT, "font", "Tipografía", "Monospace"), 
     (gimpfu.PF_SPINNER, "startfrom", "Contar desde", 0, (0, 3000, 1)) 
    ], 
    results=[], 
    function=enumerategrid, 
    menu="<Image>/Desarrollo de juegos/rejillas" 
) 

然而,當我要運行新已安裝的插件,我從瘸子得到這個錯誤:

enter image description here

好像瘸子不是當前的圖像傳遞給我的插件在,所以6個參數傳遞,而不是7.我怎樣才能解決這個問題?

回答

0

這可能看起來很奇怪,但也許嘗試

def enumerategrid(image, layer ,width, height, tcolor, theight, font, startfrom)

此處的示例可能會有所幫助。

http://registry.gimp.org/node/28124

0

的下面現在我的機器上工作。我原來的回答是正確的,你需要傳遞的參數。

請注意,我必須將菜單更改爲標籤。

#!/usr/bin/env python 
#https://stackoverflow.com/questions/27751506/gimp-the-current-image-is-not-passed-as-parameter-to-my-plug-in-function/27831408#27831408 

from gimpfu import * 
import os 



def enumerategrid(image, layer, width, height, tcolor, theight, font, startfrom): 

    pass 



register(
     proc_name="enumerategrid_plugin-pdb", 
     blurb="Enumera rejillas en una imagen", 
     help="Enumera rejillas en una imagen", 
     author="Jorge Araya Navarro <[email protected]>", 
     copyright="Servants of the Secret Fire Game Studios", 
     date="2015", 
     label="<Image>/Filters/Test/enumerate", 
     imagetypes="*", 
     params=[ 
      (PF_INT32, "width", "ancho de la reja", 32), 
      (PF_INT32, "height", "altura de la reja", 32), 
      (PF_COLOR, "tcolor", "Color del texto", (1.0, 1.0, 1.0)), 
      (PF_SPINNER, "theight", "Tamao del texto", 8, (1, 50, 1)), 
      (PF_FONT, "font", "Tipografia", "Monospace"), 
      (PF_SPINNER, "startfrom", "Contar desde", 0, (0, 3000, 1)), 
     ], 
     results=[], 
     function=enumerategrid) 



main() 
# to make example work, cannot use accented characters on my machine 
相關問題