我是 gimp python-fu 编程的新手,我花了 4 天没有运气来找出最合适的函数,以便获取绘制路径的坐标并在 gtk 消息框上显示输出,如下图所示.
请考虑我在 Windows 机器上开发
我已经尝试过这样的代码:
import gtk, gimpui
from gimpfu import *
def debugMessage(Message):
dialog = gtk.MessageDialog(None, 0, gtk.MESSAGE_INFO, gtk.BUTTONS_OK, Message)
dialog.run()
dialog.hide()
def python_fu_mahdicoordinates(image, layer):
vectors = pdb.gimp_image_get_active_vectors(image)
nstrokes, strokes = pdb.gimp_vectors_get_strokes(vectors)
stroke_type, n_points, cpoints, closed = pdb.gimp_vectors_stroke_get_points(vectors, strokes[0])
x0 = cpoints[0]
y0 = cpoints[1]
x1 = cpoints[6]
y1 = cpoints[7]
x2 = cpoints[12]
y2 = cpoints[13]
x3 = cpoints[18]
y3 = cpoints[19]
debugMessage('(' + str(x0) + ', ' + str(y0) + ', '+str(x1) + ', '+str(y1) + ', '+str(x2) + ', '+str(y2) + ', '+str(x3) + ', '+str(y3) + ')')
return
register(
"python_fu_mahdicoordinates",
"Mahdi Cooridnates",
"Get Cooridnates of any path",
"Mahdi Alkhatib", "Mahdi Alkhatib", "2016",
"Mahdi Cooridnates...",
"*",
[],
[],
python_fu_mahdicoordinates,
menu= "<Image>/Tools/Misc")
main()
有时插件本身不会显示在菜单中,有时根本没有输出。