[英]wxPython is there a way to draw half circle
Question is simple is there a way to draw half circle or pie using wxGraphicsContext ? 问题很简单,有没有一种方法可以使用wxGraphicsContext绘制半圆或饼图? I need to make something look like in the picture (this gauge is made in pyQt4). 我需要使图片看起来像(该量规是在pyQt4中制成的)。
EDIT: I did 编辑:我做到了
path = gc.CreatePath()
path.AddArc(450, 100, 30, math.radians(180), math.radians(0))
pen = wx.Pen('#ffffff', 1)
#pen.SetCap(wx.CAP_BUTT)
gc.SetBrush(wx.Brush('#CC7F32', wx.SOLID))
gc.SetPen(pen)
gc.DrawPath(path)
and I got this 我知道了
How can I get full outline because now there is none at the bottom of the arc? 由于弧线的底部现在没有轮廓,如何获得完整轮廓?
You can do it using AddArc() or, probably better in this particular case, AddArcToPoint() . 您可以使用AddArc()或更佳地在这种情况下使用AddArcToPoint()来实现 。 As always, remember that you can fill any path by setting the brush corresponding to the desired background colour and calling FillPath() instead of just StrokePath()
. 与往常一样,请记住,您可以通过设置相应的背景颜色刷,并要求填写任何路径FillPath() ,而不是仅仅StrokePath()
And to draw the segment, you should just call AddLineToPoint()
directly: it's simple as you just need to give it the coordinates of your circle centre. 绘制线段,您应该直接调用AddLineToPoint()
:这很简单,因为您只需要为其指定圆心的坐标即可。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.