What i want to do is to make a procedural variable name for a pygame draw function inside a for loop. But i just cant figure out how to do it.
I tried to follow some guides that i saw about dynamic names but they only showcased making a variable name for ints and strings.
I want to give all of rectangles their own name with a number at the end to show in what loop they were created. But i do not know how change the name of the variable from one loop to the other
This is the variable i need to name: pygame.draw.rect(screen, self.color, (self.pos[0] + self.scale * i , (self.pos[1] + (self.scale * x)), self.scale, self.scale))
Example: rect_(procedural number) = pygame.draw.rect(screen, self.color, (self.pos[0] + self.scale * i , (self.pos[1] + (self.scale * x)), self.scale, self.scale))
def invRect(self):
tset = 0
for x in range(self.rows):
for i in range(self.columns):
tset += 1
this is the function i want to give a dynamic name -----> pygame.draw.rect(screen, self.color, (self.pos[0] + self.scale * i , (self.pos[1] + (self.scale * x)), self.scale, self.scale))