Re: How do I draw a semicircle?

Andrea Gavana <[email protected]> Thu, 13 May 2021 08:30:45 +0200
Newsgroups gmane.comp.python.wxpython
Message-ID <CAEf70bxoggb+pMf2KcG93i5Lr8_9STO5Uq7qg7cLg98gCHdiGw@mail.gmail.com>
Hi,

On Thu, 13 May 2021 at 06.50, Phil <[email protected]> wrote:

> Thank you for reading this.
>
> I'm trying to create an analogue meter. So far I have a pointer that
> moves and now I'm trying to create a dial face. Just for the sake of
> simplicity, the dial face is a semicircle.
>
> I've spent a lot of time experimenting and searching for an answer
> without success. The following is based on something that I found, it
> runs but doesn't draw anything:
>
>      def OnPaint(self, e):
>
>          #pdc = wx.PaintDC(self)
>          #gc = wx.GCDC(pdc)
>
>          gc = wx.GraphicsContext.Create(wx.PaintDC(self))
>
>          path = gc.CreatePath()
>
>          path.AddArc(450, 100, 30, math.radians(180), math.radians(0))
>          pen = wx.Pen('#ffffff', 1)
>          gc.SetBrush(wx.Brush('#CC7F32', wx.SOLID))
>          gc.SetPen(pen)
>
>          gc.DrawPath(path)
>


Maybe you could take some inspiration from wx.lib.agw.speedometer:

https://wxpython.org/Phoenix/docs/html/wx.lib.agw.speedmeter.SpeedMeter.html

?

Andrea.



> --
> Regards,
> Phil
>
> --
> You received this message because you are subscribed to the Google Groups
> "wxPython-users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/wxpython-users/123c0aed-fbfe-012f-091f-7521a9abada8%40gmail.com
> .
>

-- 
You received this message because you are subscribed to the Google Groups "wxPython-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [email protected].
To view this discussion on the web visit https://groups.google.com/d/msgid/wxpython-users/CAEf70bxoggb%2BpMf2KcG93i5Lr8_9STO5Uq7qg7cLg98gCHdiGw%40mail.gmail.com.