'PYGAME screen settings

I added Setting to my game - it works fine on sound,volume and other parameters. But not on screen resolution.

short question: How can i edit the screen size in game loop and save proportion for other objects?

More details: Before the game loop i define screen and setting class.

screen = pygame.display.set_mode((screen_width,screen_height)) 
class Settings():
    def __init__(self,name,MIN,MAX,x,y):
        pygame.sprite.Sprite.__init__(self)
        self.min = MIN
        self.max = MAX
        self.value = value
        self._default = default
    
    def update(self):
        if user_activate_setting():
            self.value = user_input()


screen_setting = Setting((400,400),(1600,1200),(1024,768))

And the game loop:

while run:
    #setting dict contain all other settings variable.
    if user_on_setting:
          if screen_setting:
              screen = pygame.display.set_mode(screen_setting.update())

When i'm on changing the screen resolution all other objects saved the same size and the proportion is lost. I understand that in the begining i was supose to connect the sizes of all object according to screen variable. My question is how to overcame on this issue before i start change every object size manually?



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source