Marius Valentavicius
Marius Valentavicius

Reputation: 133

wxPython is there a way to draw half circle

Question is simple is there a way to draw half circle or pie using wxGraphicsContext? I need to make something look like in the picture (this gauge is made in pyQt4).

enter image description here

EDIT: I did

    path = gc.CreatePath()
    path.AddArc(450, 100, 30, math.radians(180), math.radians(0))
    pen = wx.Pen('#ffffff', 1)
    #pen.SetCap(wx.CAP_BUTT)
    gc.SetBrush(wx.Brush('#CC7F32', wx.SOLID))
    gc.SetPen(pen)
    gc.DrawPath(path)

and I got this

enter image description here

How can I get full outline because now there is none at the bottom of the arc?

Upvotes: 0

Views: 537

Answers (1)

VZ.
VZ.

Reputation: 22753

You can do it using AddArc() or, probably better in this particular case, AddArcToPoint(). As always, remember that you can fill any path by setting the brush corresponding to the desired background colour and calling FillPath() instead of just StrokePath().

And to draw the segment, you should just call AddLineToPoint() directly: it's simple as you just need to give it the coordinates of your circle centre.

Upvotes: 1

Related Questions