Thanks to all.I think now i have been able to make the polygon function,but
even using the cr.fill() method i am not able to fill it.Have tried out
various combinations of stroke,stroke_preserve,fill to no avail.Kindly
guide.

Here is Polygon function

def draw_polygon(Points):
for i in range(0,len(Points)-1):
print Points[i],Points[i+1]
#draw_line(Points[i],Points[i+1])
cr.move_to(Points[i][0],Points[i][1])
cr.line_to(Points[i+1][0],Points[i+1][1])
cr.set_source_rgb(0,1,0)
cr.stroke_preserve()
#cr.fill()
cr.move_to(Points[i+1][0],Points[i+1][1])
cr.line_to(Points[0][0],Points[0][1])
cr.stroke_preserve()
cr.set_source_rgb(0,0,1)
#cr.fill()


Where i am sending a polygon to be drawn as follows

x0, y0 = 40, 20
x3, y3 = 35, 80
x1, y1 = 82, 20
x2, y2 = 81, 56
pts1=[(x0,y0),(x1,y1),(x2,y2),(x3,y3)]
draw_polygon(pts1)


Thanks
_______________________________________________
pygtk mailing list   pygtk@daa.com.au
http://www.daa.com.au/mailman/listinfo/pygtk
Read the PyGTK FAQ: http://faq.pygtk.org/

Reply via email to