def update(self, event):
try:
if not self.contains(*event.pos):
if not self.focussed:
return
except AttributeError:
return
if event.type == pygame.MOUSEMOTION:
if self.contains(*event.pos):
self.focussed = True
self.mouse_entered()
else:
self.focussed = False
self.mouse_left()
self.mouse_moved(event)
elif event.type == pygame.MOUSEBUTTONDOWN and event.button == 1:
if self.contains(*event.pos):
self.clicked(event)
评论列表
文章目录