title: Draw in wx.PaintDC
body: <p>I am trying to create a canvas and draw on it based on the position of the mouse cursor.
  Example:</p>
  <pre><code>class Lienzo:
    def __init__(self):
      super().__init__()
  
      self.app2 = wx.App()
      self.ventana2 = wx.Frame(None,id= wx.ID_ANY,title= &quot;Area de dibujo&quot;,size= (800,600))
      self.icono = wx.Icon(&quot;imagenes/logo.png&quot;)
      self.ventana2.SetIcon(self.icono)
      self.panel2 = wx.Panel(self.ventana2,pos= (0,0),size= (800,600))
  
      self.contLienzo = wx.Panel(self.panel2,pos= (20,100),size= (500,400), style=wx.BORDER_SIMPLE)
      self.contLienzo.Bind(wx.EVT_LEFT_DOWN, self.pressMouse)
      self.contLienzo.Bind(wx.EVT_LEFT_UP, self.releaseMouse)
      self.contLienzo.Bind(wx.EVT_PAINT, self.dibujar)
      
      self.ventana2.Show()
      self.app2.MainLoop()
  
    def pressMouse(self,event):
      self.pos1 = event.GetPosition()
  
    def releaseMouse(self,event):
      self.pos2 = event.GetPosition()
  
    def dibujar(self,event3):
      self.lienzo = wx.PaintDC(self.contLienzo)
      self.lapiz = wx.Pen(&quot;black&quot;,width=1,style= wx.PENSTYLE_SOLID)
      self.lienzo.SetPen(self.lapiz)         
      self.lienzo.DrawLine(self.pos1.x,self.pos1.y,self.pos2.x,self.pos2.y) 
  
  obj = Lienzo()
  </code></pre>
  <p>I tried to use wx.PaintDC's DrawLine function in the releaseMouse() function but it didn't work either.
  How can I get the cursor position when pressing and releasing the mouse button?</p>