def update(self, *args):
"""
Perform any updates on the Widget if needed;
basic implementation of focus, active-state and border-rendering;
used for interaction in more advanced, derivated Widget-classes
parameters: tuple arguments for the update (first argument should be an instance pygame.event.Event)
return values: -
"""
if self.isActive() and len(args) > 0:
event = args[0]
if event.type == pygame.MOUSEBUTTONDOWN:
self.setFocused(self.rect.collidepoint(event.pos))
if self.isDirty():
self.rect = self._border.getBounds(self._bounds)
self.image = self._border.getBorderedImage(self._getAppearance(*args))
if not self.isActive():
inactive = self.image.copy()
inactive.fill(disabeledOverlay)
self.image.blit(inactive, (0, 0))
评论列表
文章目录