开发者

How to draw polygons with Point2D in wxPython?

I have input values of x, y, z coordinates in the following format:

[-11.235865 5.866001 -4.604924]

[-11.262565 5.414276 -4.842384]

[-11.291885 5.418229 -4.849229]

[-11.235865 5.866001 -4.604924]

I want to draw polygons and succeeded with making a list of wx.point objects. But I need to plot floating point coordinates so I had to change it to point2D objects but开发者_开发知识库 DrawPolygon doesn't seem to understand floating points, which returns error message: TypeError: Expected a sequence of length-2 sequences or wxPoints.

I can't find anywhere in the API that can draw shapes based on point2D coordinates, could anyone tell me a function name will do the job?

Thanks


I think you should use matplotlib as it seems you need numerical data plotting.


You just have to pass a list of XY tuples. In wxPython you don't have to explicitly use Point2D objects.

points = [
    (-11.235865, 5.866001),
    (-11.262565, 5.414276),
    (-11.291885, 5.418229),
    (-11.235865, 5.866001),
]

dc.DrawPolygon(points)


DC's only use integers. Try using Cairo or wx.GraphicsContext.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜