2016-11-15 4 views
0

나는 계기를 그리기 위해 wx python을 사용하고 있습니다. 그리고 drawarc과 drawCircle을 사용합니다. 하지만 예상 한 결과가 아닙니다. 원호와 원은 정확하게 그려지지 않고 추한 것처럼 보입니다.wx python draw 원호와 원

   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) 

답변

2

GaugeImage는 현재 사용중인 DC의 상단에 wx.GraphicsContext을 만듭니다. 자세한 내용은 in wxPython Phoenix docs을 참조하십시오. GraphicsContext에 그리면 멋진 앤티 앨리어스 그래픽이 제공됩니다. 도면 명령은 GraphicsContext에서 약간 다를 수 있습니다.

+1

'wx.GCDC'는 그래픽 컨텍스트를 사용하도록 코드를 전환하는 좋은 방법입니다. 그것은'wx.GraphicsContext'의 상단에'wx.DC' API를 구현합니다. – RobinDunn

+0

@RobinDunn : wxPython classic에서 기존 GCDC를 사용하는 데 어려움이 있었기 때문에 GCDC를 언급하지 않았지만 좋은 점! – nepix32