I would like to know how self works in python, I know that it has to do something with the classes but I do not have it so clear and I need to know to convert it into an arrangement, here there is little of the code
class Button(pygame.sprite.Sprite):
def __init__(self,image):
pygame.sprite.Sprite.__init__(self)
self.image, self.rect = load_image(image)
def setCords(self,x,y):
self.rect.topleft = x,y
screen.blit(self.image, (x,y))
def pressed(self,mouse):
if mouse[0] > self.rect.topleft[0]:
if mouse[1] > self.rect.topleft[1]:
if mouse[0] < self.rect.bottomright[0]:
if mouse[1] < self.rect.bottomright[1]:
return True
else: return False
else: return False
else: return False
else: return False
The help is already appreciated and if you can give me advice on how to pass it to arrangement and function I would be very grateful to you because I am just with all this