TypeError occurs when self.button=None in MouseEvents