我花了一段时间试图让 GIMP 注册一个我为开始学习而编写的经典“hello world”插件的示例。最后,在仔细检查文件位置和 GIMP 首选项中插件的路径以及使用 chmod 在终端中更改执行 .py 的用户权限后,我将其注册。
让它工作!正如我在代码中所写的那样,“你好”出现在文件下拉菜单下。问题是它没有显示带有我期待已久的消息的控制台框!
如果我转到 GIMP 中的 python-fu 控制台,我可以在 PDB 中找到我的插件,当我单击应用并从控制台运行它时,我会收到执行错误,
Traceback (most recent call last):
File "<input>", line 1, in <module>
RuntimeError: execution error
我希望我的代码是正确的,我的大问题只是注册,但现在我的希望破灭了!我的代码有什么问题吗:
#!/usr/bin/env python
from gimpfu import *
def hello_world(image, drawable):
pdb.gimp_message("Hello World")
register("python-fu-hello-world", "hello", "helloooo", "X. D.", "X. D.", "2018", "Hello", "", [], [], hello_world, menu="<Image>/File")
main()
(Macbook OS 10.11、python 2.7、GIMP 2.8)