title: Using GIFs in PyGame
body: <p>I read up on how to use GIFs in PyGame, and most of them said to split the GIF into images, and render each of them using a list, I tried implementing that, but I got one static image. I guess that it was too fast for me to see. I also tried a library called GIFImage <a href="https://ajaxvm.com/downloads/GIFImage.py" rel="nofollow noreferrer">here</a>, it, however failed and produced the same static image. Edit: The static image is 'idle/idle (4).jpg'</p>
  
  <p>Code:</p>
  
  <pre><code>import pygame
  from random import *
  pygame.init()
  screen = pygame.display.set_mode((400, 300))
  running = True
  spriteVY = 3
  clock = pygame.time.Clock()
  
  idle_imgs = (
      "idle/idle (1).jpg",
      "idle/idle (2).jpg",
      "idle/idle (3).jpg",
      "idle/idle (4).jpg"
  )
  
  class MySprite(pygame.sprite.Sprite):
      def __init__(self, x, y):
          super().__init__()
          self.vel = (0, 0)
          self.image = pygame.Surface((100, 200))
          self.image.fill((255, 255, 255))
          self.rect = self.image.get_rect(topleft = (x, y))
  
  class Platform(pygame.sprite.Sprite):
      def __init__(self, x, y):
          super().__init__()
          self.image = pygame.Surface((100, 10))
          self.image.fill((142, 212, 25))
          self.rect = self.image.get_rect(topleft = (x, y))
  
  sprite = MySprite(100, 100)
  platform = Platform(50, 20)
  group = pygame.sprite.Group([sprite, platform])
  
  on_ground = True
  while running:
  
      for event in pygame.event.get():
          if event.type == pygame.QUIT:
              running = False
  
      if pygame.key.get_pressed()[pygame.K_SPACE]: sprite.rect.y -= 20
      if pygame.key.get_pressed()[pygame.K_d]: sprite.rect.x += 10
      if pygame.key.get_pressed()[pygame.K_a]: sprite.rect.x -= 10
  
      if platform.rect.colliderect(sprite.rect):
          pass
      if sprite.rect.x &lt;= 0:
          sprite.rect.x = 0
      if sprite.rect.x &gt;= 300:
          sprite.rect.x = 300
      if sprite.rect.y &lt; 100:
          on_ground = False
      if sprite.rect.y &gt;= 100:
          spriteVY = 0
          on_ground = True
          sprite.rect.y = 100
      if not on_ground:
  
          sprite.rect.y += spriteVY
          spriteVY += 1
      screen.fill((0, 0, 0))
      group.draw(screen)
      for img in idle_imgs:
          print(img)
          chosen_img = pygame.image.load(img)
          screen.blit(chosen_img, ((100, 100)))
      pygame.display.flip()
      clock.tick(24)
  </code></pre>