wx python绘制弧和圆

时间:2016-11-15 18:27:16

标签: wxpython automatic-ref-counting draw

我正在使用wx python绘制一个标尺。我使用drawarc和drawCircle。 但结果并不像我预期的那样。圆弧和圆圈不是精确绘制的,看起来很丑陋。 GaugeImage

                pen = wx.Pen(wx.WHITE,2)
                dc.SetPen(pen)
                xFullCoordinate = (x + (OutsideRadius * math.cos((0.5 * math.pi) + (FullDeg * math.pi * newValue)/((MaxValue - MinValue) * 180))))
                yFullCoordinate = (y + (OutsideRadius * math.sin((0.5 * math.pi) + (FullDeg * math.pi * newValue)/((MaxValue - MinValue) * 180))))
                xStartCoodrinate = (x + (OutsideRadius * math.cos((0.5 * math.pi) + (StartDeg * math.pi) / 180)))
                yStartCoodrinate = (y + (OutsideRadius * math.sin((0.5 * math.pi) + (StartDeg * math.pi) / 180)))
                dc.DrawArc((xFullCoordinate,yFullCoordinate),(xStartCoodrinate,yStartCoodrinate),(x, y))
                dc.SetBrush(wx.Brush((48,100,175)))
                dc.DrawCircle(x, y, InsideRadius)

1 个答案:

答案 0 :(得分:2)

在您当前使用的DC之上创建wx.GraphicsContext。请参阅in wxPython Phoenix docs了解具体方法。在GraphicsContext上绘图将提供很好的抗锯齿图形。请注意,GraphicsContext的绘图命令可能略有不同。