title: Getting a weird order problem when running this script
body: <p>so i'm making a game for the sea jam and i've been getting this error where running my two buttons only the one on top works i don't think it's one of the functions or the class but if it is please share i need to finish this by the 29th of novemember it's my first jam, here is the code:</p>
  <pre><code>import pygame
  
  sh = 400
  sw = 400
  
  pygame.font.init() # you have to call this at the start, 
                     # if you want to use this module.
  
  
  screen = pygame.display.set_mode((sh, sw))
  b = pygame.image.load(&quot;b.png&quot;).convert_alpha()
  ub = pygame.image.load(&quot;ub.png&quot;).convert_alpha()
  scr = 0
  
  
  class ubut():
    def __init__(self,x,y,image):
      self.image = image
      self.rect = self.image.get_rect()
      self.rect.topleft = (x, y)
    def draw(self):
      screen.blit(self.image, (self.rect.x, self.rect.y))
      mpos = pygame.mouse.get_pos()
      global scr
      for event in pygame.event.get():
        if event.type == pygame.MOUSEBUTTONUP:
          if self.rect.collidepoint(mpos):
            print(&quot;x&quot;)
  
  
  class but():
    def __init__(self,x,y,image):
      self.image = image
      self.rect = self.image.get_rect()
      self.rect.topleft = (x, y)
    def draw(self):
      screen.blit(self.image, (self.rect.x, self.rect.y))
      mpos = pygame.mouse.get_pos()
      for event in pygame.event.get():
        if event.type == pygame.MOUSEBUTTONUP:
          if self.rect.collidepoint(mpos):
            global scr
            scr += 1
            print(scr)
    def redb(self):
          mpos = pygame.mouse.get_pos()
          for event in pygame.event.get():
            if event.type == pygame.MOUSEBUTTONUP:
              if self.rect.collidepoint(mpos):
                global scr
                scr += 1
                print(scr)
    def purpb(self):
          mpos = pygame.mouse.get_pos()
          for event in pygame.event.get():
            if event.type == pygame.MOUSEBUTTONUP:
              if self.rect.collidepoint(mpos):
                print(&quot;x&quot;)
  
  
  
  
  buttton = but(125,125 , b)
  ubutton = but(125,225,ub)
  run = True
  
  while run:
    screen.fill((0,255,0))
    ubutton.purpb()
    ubutton.draw()
    buttton.draw()
    buttton.redb()
    
    mpos = pygame.mouse.get_pos()
    
    pygame.display.update()
  </code></pre>
  <p>thanks for the help.</p>