Reputation: 153
I am using wx python to draw a gauge. And I use drawarc and drawCircle. But the result is not as I expected. The arc and the circle are not precisely draw and looks ugly. 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)
Upvotes: 0
Views: 899
Reputation: 3177
Create a wx.GraphicsContext
on top of the DC you are currently using. See in wxPython Phoenix docs to see how. Drawing on the GraphicsContext will give nice antialiased graphics. Be advised that the drawing commands may be slightly different for the GraphicsContext
.
Upvotes: 2