parameters: (self, x, y)
docstring: Returns True iff this object contains the given point.
  
              This is used to determine if the user clicked on the object.
docstring_summary: Returns True iff this object contains the given point.
docstring_tokens: Returns True iff this object contains the given point .
function: def objectContainsPoint(self, x, y):
          """ Returns True iff this object contains the given point.
  
              This is used to determine if the user clicked on the object.
          """
          # Firstly, ignore any points outside of the object's bounds.
  
          if x < self.position.x: return False
          if x > self.position.x + self.size.x: return False
          if y < self.position.y: return False
          if y > self.position.y + self.size.y: return False
  
          # Now things get tricky.  There's no straightforward way of
          # knowing whether the point is within an arbitrary object's
          # bounds...to get around this, we draw the object into a
          # memory-based bitmap and see if the given point was drawn.
          # This could no doubt be done more efficiently by some tricky
          # maths, but this approach works and is simple enough.
  
          # Subclasses can implement smarter faster versions of this.
  
          bitmap = wx.EmptyBitmap(self.size.x + 10, self.size.y + 10)
          dc = wx.MemoryDC()
          dc.SelectObject(bitmap)
          dc.BeginDrawing()
          dc.SetBackground(wx.WHITE_BRUSH)
          dc.Clear()
          dc.SetPen(wx.Pen(wx.BLACK, self.lineSize + 5, wx.SOLID))
          dc.SetBrush(wx.BLACK_BRUSH)
          self._privateDraw(dc, wx.Point(5, 5), True)
          dc.EndDrawing()
          pixel = dc.GetPixel(x - self.position.x + 5, y - self.position.y + 5)
          if (pixel.Red() == 0) and (pixel.Green() == 0) and (pixel.Blue() == 0):
              return True
          else:
              return False
function_tokens: def objectContainsPoint ( self , x , y ) : # Firstly, ignore any points outside of the object's bounds. if x < self . position . x : return False if x > self . position . x + self . size . x : return False if y < self . position . y : return False if y > self . position . y + self . size . y : return False # Now things get tricky.  There's no straightforward way of # knowing whether the point is within an arbitrary object's # bounds...to get around this, we draw the object into a # memory-based bitmap and see if the given point was drawn. # This could no doubt be done more efficiently by some tricky # maths, but this approach works and is simple enough. # Subclasses can implement smarter faster versions of this. bitmap = wx . EmptyBitmap ( self . size . x + 10 , self . size . y + 10 ) dc = wx . MemoryDC ( ) dc . SelectObject ( bitmap ) dc . BeginDrawing ( ) dc . SetBackground ( wx . WHITE_BRUSH ) dc . Clear ( ) dc . SetPen ( wx . Pen ( wx . BLACK , self . lineSize + 5 , wx . SOLID ) ) dc . SetBrush ( wx . BLACK_BRUSH ) self . _privateDraw ( dc , wx . Point ( 5 , 5 ) , True ) dc . EndDrawing ( ) pixel = dc . GetPixel ( x - self . position . x + 5 , y - self . position . y + 5 ) if ( pixel . Red ( ) == 0 ) and ( pixel . Green ( ) == 0 ) and ( pixel . Blue ( ) == 0 ) : return True else : return False