[Python] Intractability issue with pygame settings menu

Discussão em 'Python' iniciado por Stack, Agosto 10, 2025.

  1. Stack

    Stack Membro Participativo

    PYgame resolution issue


    My current problem is the 1440x900 resolution png is not having any intractability, when I open the settings menu it does print the 'a', so it is running, but when I click the png, the a printing pauses but it doesn't change the resolution. Any idea how I can fix this?

    Code below:

    while running:
    for self.event in pygame.event.get():
    if self.event.type == pygame.QUIT:
    running = False
    if self.event.type == pygame.MOUSEBUTTONUP:
    pos = pygame.mouse.get_pos()

    # Fill the screen with black
    def filler():
    if self.filler == 0:
    self.screen.fill((0, 0, 0))

    # Draw settings button
    back = pygame.image.load('Back.png').convert_alpha()
    backbounds = back.get_rect(center=(self.screenwidth // 4, self.screenheight / 1.5))
    settingsbutton = pygame.image.load('settings.png').convert_alpha()
    stngs = settingsbutton.get_rect()
    if self.solid == 0:
    self.screen.blit(settingsbutton, stngs)

    if self.init == 0:
    if stngs.collidepoint(pos):
    menublock = 1
    self.solid += 1
    if self.settingsmoment == 0:
    settingsmenu = pygame.image.load('settingmenu.png').convert_alpha()
    stnmbounds = settingsmenu.get_rect()
    resolution = pygame.image.load('resolution.png').convert_alpha()
    resobounds = resolution.get_rect(center=(self.screenwidth // 2, self.screenheight // 4))
    res1 = pygame.image.load('1280x768.png').convert_alpha()
    res1bounds = res1.get_rect(center=(self.screenwidth / 1.75, self.screenheight / 3))
    self.res2 = pygame.image.load('1440x900.png').convert_alpha()
    self.res2bounds = self.res2.get_rect(center=(self.screenwidth / 1.5, self.screenheight / 2))
    #self.screen.blit(fill, fillbounds)
    if self.init == 0:
    if self.nofill == 0:
    filler()
    self.screen.blit(settingsmenu, stnmbounds)
    self.screen.blit(back, backbounds)
    self.screen.blit(resolution, resobounds)
    # blit rest of options: resolution, text scroll, etc.
    #self.resolution = input('resolution: ')

    if resobounds.collidepoint(pos):
    if self.resos != 1:
    self.screen.blit(res1, res1bounds)
    self.screen.blit(self.res2, self.res2bounds)
    #self.nofill += 1

    if res1bounds.collidepoint(pos): # set resolution for 1280x768p
    self.resolution = '1280x768'
    self.screenwidth = 1280
    self.screenheight = 768
    pygame.display.set_mode((self.screenwidth, self.screenheight))
    self.resos += 1
    pygame.display.flip()

    #print(pygame.mouse.get_pos())
    if self.resos != 9:
    print('a')
    if self.res2bounds.collidepoint(pos):
    self.resolution = '1440x900'
    self.screenwidth = 1440
    self.screenheight = 900
    pygame.display.set_mode((self.screenwidth, self.screenheight))
    self.resos += 1
    pygame.display.flip()

    if backbounds.collidepoint(pos):
    menublock = 3
    #self.init = 10
    #self.solid -= 1
    #self.solid = 10
    #self.settingsmoment = 10
    #if self.solid == 0:
    if self.jawn == 0:
    filler()

    Continue reading...

Compartilhe esta Página