def HitTest(self, x, y):
"""
Test if point is inside button
@param x: X coordinate of point
@param y: Y coordinate of point
@return: True if button is active and displayed and point is inside
button
"""
# Return immediately if button is hidden or inactive
if not (self.IsShown() and self.IsEnabled()):
return False
# Test if point is inside button
w, h = self.Bitmap.GetSize()
rect = wx.Rect(self.Position.x, self.Position.y, w, h)
return rect.InsideXY(x, y)
评论列表
文章目录