Hello.
On 09.06.06, Etrade Griffiths wrote:
> sorry if this is seems a trivial request but I am trying to read a set of
> polygons from file and plot them using PyX. PyX runs OK (ie no errors) but
> nothing appears on the canvas! The file contains data in this form
>
> poly_1, x0, y0
> poly_1, x1, y1
> ...
> poly_2, x0, y0
>
> Here is a code snippet
>
> in_file=open("myfile","r")
> c=canvas.canvas()
>
> for line in in_file
> # ... stuff here to read the polygon name and (x,y) coords as x0, y0
>
> if (encountered_new_polygon_name):
> # plot previous polygon
> p.append(path.closepath())
> c.stroke(p)
Just to continue guessing about code that we never saw:
What is p when the loop is entered? Is it something you can "stroke"?
Stroking a path which starts with a closepath does not work.
> # reset path and start new path
> p=path.path(path.moveto(x0,y0))
> else
> # still on same polygon so append data
> p.append(path(lineto(x0,y0))
>
Michael.
--
"A mathematician is a device for turning coffee into theorems"
Paul Erdös.
_______________________________________________
PyX-user mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/pyx-user