I've made a slider which should update the size of a grid that I have made. When the slider is clicked and moved the value of the slider changes however the grid size stays the same and does not update. How would I solve this? thanks.

Here is the function that I use to update the slider value. This is called when the slider is clicked in the game loop

```
def slider_loop(s):
    s.move()
    grid_size = int(slider_value.val)
    return grid_size

```

here is the section in the main game loop where the slider loop is called

```
    for s in slides:
        if s.hit:
            slider_loop(s)

```

here is the slider class

```
class slider():
    def __init__(self, name, val, maxi, mini, x_pos, y_pos):
        font = pygame.font.SysFont("Verdana", 12)
        self.val = val  # start value
        self.maxi = maxi  # maximum at slider position right
        self.mini = mini  # minimum at slider position left
        self.xpos = x_pos  # x-location on screen
        self.ypos = y_pos
        self.surf = pygame.surface.Surface((100, 50))
        self.hit = False  # the hit attribute indicates slider movement due to mouse interaction

        self.txt_surf = font.render(name, 1, black)
        self.txt_rect = self.txt_surf.get_rect(center=(50, 15))

        # Static graphics - slider background #
        self.surf.fill((100, 100, 100))
        pygame.draw.rect(self.surf, grey, [0, 0, 100, 50], 3)
        pygame.draw.rect(self.surf, orange, [10, 10, 80, 10], 0)
        pygame.draw.rect(self.surf, white, [10, 30, 80, 5], 0)

        self.surf.blit(self.txt_surf, self.txt_rect)  # this surface never changes

        # dynamic graphics - button surface #
        self.button_surf = pygame.surface.Surface((20, 20))
        self.button_surf.fill(trans)
        self.button_surf.set_colorkey(trans)
        pygame.draw.circle(self.button_surf, black, (10, 10), 6, 0)
        pygame.draw.circle(self.button_surf, orange, (10, 10), 4, 0)

    def draw(self):
        """ Combination of static and dynamic graphics in a copy of
the basic slide surface
"""
        # static
        surf = self.surf.copy()

        # dynamic
        pos = (10+int((self.val-self.mini)/(self.maxi-self.mini)*80), 33)
        self.button_rect = self.button_surf.get_rect(center=pos)
        surf.blit(self.button_surf, self.button_rect)
        self.button_rect.move_ip(self.xpos, self.ypos)  # move of button box to correct screen position

        # screen
        screen.blit(surf, (self.xpos, self.ypos))

    def move(self):
        """
The dynamic part; reacts to movement of the slider button.
"""
        self.val = (pygame.mouse.get_pos()[0] - self.xpos - 10) / 80 * (self.maxi - self.mini) + self.mini
        if self.val < self.mini:
            self.val = self.mini
        if self.val > self.maxi:
            self.val = self.maxi

```