0
我正在使用wx python绘制标尺。我使用drawarc和drawCircle。 但结果并非如我所料。圆弧和圆不精确绘制,看起来很丑。 GaugeImagewx python绘制圆弧和圆
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)
'wx.GCDC'是将代码转换为使用图形上下文的好方法。它在'wx.GraphicsContext'的顶部实现了'wx.DC' API。 – RobinDunn
@RobinDunn:我没有提及''GCDC'',因为我在wxPython经典版中使用它时遇到了问题(发现很难将GCDC放在现有的DC之上),但是好点! – nepix32