Tôi mới tham gia lập trình python-fu gimp Tôi đã dành 4 ngày KHÔNG CÓ LUCK để tìm ra các chức năng phù hợp nhất để sử dụng để có được tọa độ của đường dẫn được vẽ và hiển thị đầu ra trên hộp thư gtk như hình ảnh sau đây.Gimp: Làm thế nào tôi có thể nhận được tọa độ của các điểm công cụ đường dẫn?
Vui lòng xem xét mà tôi phát triển trên cửa sổ máy
Tôi đã thử mã của tôi như thế này:
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()
Đôi khi các plugin tự nó không hiển thị trong menu, đôi khi không có đầu ra ở tất cả.