code: def is_in_free_area(self, nr, ok = -1):
          
          for i, r in enumerate(self.link_rects):
              if r.Intersects(nr) and i != ok:
                  return False
          bmrect = wx.Rect(0,0,dlg.bitmap.Size[0],dlg.bitmap.Size[1])
          return bmrect.Contains(nr)
docs: Determine if rect covers a free area inside the bitmap.