wx python 画弧和圆

wx python draw arc and circle

我正在使用 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)

在您当前使用的 DC 之上创建一个 wx.GraphicsContext。请参阅 in wxPython Phoenix docs 了解操作方法。在 GraphicsContext 上绘图将提供漂亮的抗锯齿图形。请注意,GraphicsContext.

的绘图命令可能略有不同