import wx

class DrawPanel(wx.Frame):
    def __init__(self, height_, width_):
        wx.Frame.__init__(self, None, title="Draw on Panel")
        self.Bind(wx.EVT_PAINT, self.OnPaint)
        self.height = height_
        self.width  = width_
        
    def draw(self, dc_):
        # hor lines
        dc_.SetPen(wx.Pen(wx.BLACK, 1, wx.SOLID))
        dc_.DrawLine(0,   0, 300,   0)   # x1,y1 upto but not incl. x2,y2
        dc_.DrawLine(0, 100, 300, 100)
        dc_.DrawLine(0, 200, 300, 200)

        # vert lines
        dc_.SetPen(wx.Pen(wx.RED, 1, wx.SOLID))
        dc_.DrawLine(25,   0, 25, 101)   # last pixel is ON the hor. line

        dc_.SetPen(wx.Pen(wx.RED, 1, wx.SOLID))
        dc_.DrawLine(50, 100, 50, 200)   # last pixel is ABOVE the hor. line

        dc_.SetPen(wx.Pen(wx.BLACK, 1, wx.SOLID))
        dc_.DrawLine(100, 0, 100, 100)
        dc_.DrawLine(200, 0, 200, 100)

        # arch, drawn counter-clockwise direction from x1,y1 to x2,y2
        dc_.SetPen(wx.Pen(wx.RED, 1))
        dc_.SetBrush(wx.TRANSPARENT_BRUSH)   # don't show radius lines!
        dc_.DrawArc(200,   0,  # x1, y1 start point
                    100, 100,  # x2, y2 end   point
                    200, 100)  # xc, yc circle center

        dc_.SetPen(wx.Pen(wx.RED, 1))
        dc_.SetBrush(wx.Brush(wx.YELLOW))   # show radius lines
        dc_.DrawArc(300,   0,  # x1, y1 start point
                    200, 100,  # x2, y2 end   point
                    300, 100)  # xc, yc circle center
    # end draw
    
    def OnPaint(self, event=None):
        dc = wx.PaintDC(self)
        dc.Clear()
        self.draw(dc)

        svgfile = wx.SVGFileDC('svg_arch_line.svg', width = self.width, height = self.height)
        self.draw(svgfile)
        svgfile.Destroy()   # to close the output file
    # end OnPaint

# main
app   = wx.App(False)
frame_h = 201
frame_w = 301
frame = DrawPanel(frame_h, frame_w)
frame.SetClientSize((frame.width, frame.height))   # sets the size of the INSIDE of a window
frame.Show()
app.MainLoop()
