def AddChild(self, child): RibbonControl.AddChild(self, child) # Window enter / leave events count for only the window in question, not # for children of the window. The panel wants to be in the hovered state # whenever the mouse cursor is within its boundary, so the events need to # be attached to children too. child.Bind(wx.EVT_ENTER_WINDOW, self.OnMouseEnterChild) child.Bind(wx.EVT_LEAVE_WINDOW, self.OnMouseLeaveChild)