I am new to gimp python-fu programming I have spent my 4 days WITH NO LUCK to figure out which is the best appropriate functions to use in order to get the coordinates of drawn path and show the output on gtk message box like the following image.
Please consider that I develop on windows machine
I have tried my code like this:
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()
Sometimes the plugin itself does not show in the menu, sometimes no output at all.