Creating a GIF in pygame












0















I have tried to make a GIF work by using pygame.image.load but it seems not to work. The image is in the player_1 class and the object is called player_one. The draw function blits the picture at the xpos and the ypos. Can you please try and show me how I can swap the blit in the draw function with something else and how to use the draw function in the while loop?



import pygame
import random
import sys

pygame.init()
screen = pygame.display.set_mode((1280, 720))
clock = pygame.time.Clock() # A clock to limit the frame rate.
pygame.display.set_caption("this game")


class Background:
picture = pygame.image.load("C:/images/cliff.jpg").convert()
picture = pygame.transform.scale(picture, (1280, 720))

def __init__(self, x, y):
self.xpos = x
self.ypos = y

def draw(self):
screen.blit(self.picture, (self.xpos, self.ypos))


class player_1:
picture = pygame.image.load("C:/aliens/Giantmechanicalcrab2.gif")
picture = pygame.transform.scale(picture, (200, 200))

def __init__(self, x, y):
self.ypos = y
self.xpos = x
self.speed_x = 0
self.speed_y = 0
self.rect = self.picture.get_rect()


def update(self):
self.xpos =+ self.speed_x
self.ypos =+ self.speed_y

def draw(self): #left right
#screen.blit(pygame.transform.flip(self.picture, True, False), self.rect)
screen.blit(self.picture, (self.xpos, self.ypos))




class player_2:
picture = pygame.image.load("C:/aliens/Giantmechanicalcrab2.gif")
picture = pygame.transform.scale(picture, (200, 200))
def __init__(self, x, y):
self.ypos = y
self.xpos = x
self.speed_x = 0
self.speed_y = 0
self.rect = self.picture.get_rect()

def update(self):
self.xpos =+ self.speed_x
self.ypos =+ self.speed_y

def draw(self):
screen.blit(self.picture, (self.xpos, self.ypos))
#screen.blit(pygame.transform.flip(self.picture, True, False), self.rect)


class Bullet_player_1(pygame.sprite.Sprite):
picture = pygame.image.load("C:/aliens/giphy.gif").convert_alpha()
picture = pygame.transform.scale(picture, (100, 100))


def __init__(self):
self.xpos = 360
self.ypos = 360
self.speed_x = 0
super().__init__()
self.rect = self.picture.get_rect()


def update(self):
self.xpos += self.speed_x

def draw(self):
screen.blit(self.picture, (self.xpos, self.ypos))
#self.screen.blit(pygame.transform.flip(self.picture, False, True), self.rect)

def is_collided_with(self, sprite):
return self.rect.colliderect(sprite.rect)





class Bullet_player_2(pygame.sprite.Sprite):
picture = pygame.image.load("C:/aliens/MajesticLavishBackswimmer-size_restricted.gif").convert_alpha()
picture = pygame.transform.scale(picture, (100, 100))


def __init__(self):
self.xpos = 360
self.ypos = 360
self.speed_x = 0
super().__init__()
self.rect = self.picture.get_rect()


def update(self):
self.xpos -= self.speed_x

def draw(self):
screen.blit(self.picture, (self.xpos, self.ypos))
#self.screen.blit(pygame.transform.flip(self.picture, True, False), self.rect)

def is_collided_with(self, sprite):
return self.rect.colliderect(sprite.rect)




bullet_list = pygame.sprite.Group()
#player_two_bullet_list = pygame.sprite.Group()
player_one = player_1(0, 0)
#player_two = player_2(0, 720)
cliff = Background(0, 0)

while True:
for event in pygame.event.get():
if event.type == pygame.QUIT:
pygame.quit()
sys.exit()

elif event.type == pygame.KEYDOWN:
if event.key == pygame.K_w:
player_one.speed_y = -5

elif event.key == pygame.K_s:
player_one.speed_y = 5

#elif event.key == pygame.K_UP:
#player_two.speed_y = -5

#elif event.key == pygame.K_DOWN:
#player_two.speed_y = 5


elif event.key == pygame.K_SPACE:
bullet = Bullet_player_1

bullet.ypos = player_one.ypos
bullet.xpos = player_one.xpos

bullet.speed_x = 14

bullet_list.add(bullet)


#elif event.key == pygame.K_KP0:
#bullet_player_two = Bullet_player_2

#bullet_player_two.ypos = player_two.ypos
#bullet_player_two.xpos = player_two.xpos

#bullet_player_two.speed_x = 14

#player_two_bullet_list.add(bullet_player_two)


elif event.type == pygame.KEYUP:
if event.key == pygame.K_d and player_one.speed_x > 0:
player_one.speed_x = 0
elif event.key == pygame.K_a and player_one.speed_x < 0:
player_one.speed_x = 0


#elif event.key == pygame.K_UP and player_two.speed_x > 0:
#player_two.speed_x = 0
#elif event.key == pygame.K_DOWN and player_two.speed_x < 0:
#player_two.speed_x = 0


player_one.update()
#player_two.update()
cliff.draw()
player_one.draw()
#player_two.draw()

bullet_list.update()
#player_two_bullet_list.update()

for bullete in bullet_list:
bullet.draw()


#for bullet_player_two in player_two_bullet_list:
#bullet_player_two.draw()


pygame.display.flip()
clock.tick(60)









share|improve this question




















  • 3





    Your title asks about creating a GIF, but your question is how to use it. Also, "schemes to not work" may be factually correct but it does not help us visualizing what you are encountering. Finally: are the contents of your gif files an important factor of your problems? If so, please provide a link. If the actual images are not part of the problem, you could perhaps change your code to draw simple rectangles instead.

    – usr2564301
    Nov 24 '18 at 13:16











  • @Will.2004 what exactly happens when you load the gif? Do you get an error message? Is the gif animated or just a static image? You could add the gif to the question, so that we can try to run your code.

    – skrx
    Nov 24 '18 at 15:18













  • @skrx No it just loads onto the screen and acts the same way as a picture

    – user10632736
    Nov 24 '18 at 20:37











  • Could you add the gif to the question? Or have you already fixed the problem? I've checked out the code with one of my images and it seems to work correctly (the images are visible).

    – skrx
    Nov 25 '18 at 1:25











  • The gif goes onto the screen but doesn't move like gifs are supposed to

    – user10632736
    Nov 25 '18 at 11:35
















0















I have tried to make a GIF work by using pygame.image.load but it seems not to work. The image is in the player_1 class and the object is called player_one. The draw function blits the picture at the xpos and the ypos. Can you please try and show me how I can swap the blit in the draw function with something else and how to use the draw function in the while loop?



import pygame
import random
import sys

pygame.init()
screen = pygame.display.set_mode((1280, 720))
clock = pygame.time.Clock() # A clock to limit the frame rate.
pygame.display.set_caption("this game")


class Background:
picture = pygame.image.load("C:/images/cliff.jpg").convert()
picture = pygame.transform.scale(picture, (1280, 720))

def __init__(self, x, y):
self.xpos = x
self.ypos = y

def draw(self):
screen.blit(self.picture, (self.xpos, self.ypos))


class player_1:
picture = pygame.image.load("C:/aliens/Giantmechanicalcrab2.gif")
picture = pygame.transform.scale(picture, (200, 200))

def __init__(self, x, y):
self.ypos = y
self.xpos = x
self.speed_x = 0
self.speed_y = 0
self.rect = self.picture.get_rect()


def update(self):
self.xpos =+ self.speed_x
self.ypos =+ self.speed_y

def draw(self): #left right
#screen.blit(pygame.transform.flip(self.picture, True, False), self.rect)
screen.blit(self.picture, (self.xpos, self.ypos))




class player_2:
picture = pygame.image.load("C:/aliens/Giantmechanicalcrab2.gif")
picture = pygame.transform.scale(picture, (200, 200))
def __init__(self, x, y):
self.ypos = y
self.xpos = x
self.speed_x = 0
self.speed_y = 0
self.rect = self.picture.get_rect()

def update(self):
self.xpos =+ self.speed_x
self.ypos =+ self.speed_y

def draw(self):
screen.blit(self.picture, (self.xpos, self.ypos))
#screen.blit(pygame.transform.flip(self.picture, True, False), self.rect)


class Bullet_player_1(pygame.sprite.Sprite):
picture = pygame.image.load("C:/aliens/giphy.gif").convert_alpha()
picture = pygame.transform.scale(picture, (100, 100))


def __init__(self):
self.xpos = 360
self.ypos = 360
self.speed_x = 0
super().__init__()
self.rect = self.picture.get_rect()


def update(self):
self.xpos += self.speed_x

def draw(self):
screen.blit(self.picture, (self.xpos, self.ypos))
#self.screen.blit(pygame.transform.flip(self.picture, False, True), self.rect)

def is_collided_with(self, sprite):
return self.rect.colliderect(sprite.rect)





class Bullet_player_2(pygame.sprite.Sprite):
picture = pygame.image.load("C:/aliens/MajesticLavishBackswimmer-size_restricted.gif").convert_alpha()
picture = pygame.transform.scale(picture, (100, 100))


def __init__(self):
self.xpos = 360
self.ypos = 360
self.speed_x = 0
super().__init__()
self.rect = self.picture.get_rect()


def update(self):
self.xpos -= self.speed_x

def draw(self):
screen.blit(self.picture, (self.xpos, self.ypos))
#self.screen.blit(pygame.transform.flip(self.picture, True, False), self.rect)

def is_collided_with(self, sprite):
return self.rect.colliderect(sprite.rect)




bullet_list = pygame.sprite.Group()
#player_two_bullet_list = pygame.sprite.Group()
player_one = player_1(0, 0)
#player_two = player_2(0, 720)
cliff = Background(0, 0)

while True:
for event in pygame.event.get():
if event.type == pygame.QUIT:
pygame.quit()
sys.exit()

elif event.type == pygame.KEYDOWN:
if event.key == pygame.K_w:
player_one.speed_y = -5

elif event.key == pygame.K_s:
player_one.speed_y = 5

#elif event.key == pygame.K_UP:
#player_two.speed_y = -5

#elif event.key == pygame.K_DOWN:
#player_two.speed_y = 5


elif event.key == pygame.K_SPACE:
bullet = Bullet_player_1

bullet.ypos = player_one.ypos
bullet.xpos = player_one.xpos

bullet.speed_x = 14

bullet_list.add(bullet)


#elif event.key == pygame.K_KP0:
#bullet_player_two = Bullet_player_2

#bullet_player_two.ypos = player_two.ypos
#bullet_player_two.xpos = player_two.xpos

#bullet_player_two.speed_x = 14

#player_two_bullet_list.add(bullet_player_two)


elif event.type == pygame.KEYUP:
if event.key == pygame.K_d and player_one.speed_x > 0:
player_one.speed_x = 0
elif event.key == pygame.K_a and player_one.speed_x < 0:
player_one.speed_x = 0


#elif event.key == pygame.K_UP and player_two.speed_x > 0:
#player_two.speed_x = 0
#elif event.key == pygame.K_DOWN and player_two.speed_x < 0:
#player_two.speed_x = 0


player_one.update()
#player_two.update()
cliff.draw()
player_one.draw()
#player_two.draw()

bullet_list.update()
#player_two_bullet_list.update()

for bullete in bullet_list:
bullet.draw()


#for bullet_player_two in player_two_bullet_list:
#bullet_player_two.draw()


pygame.display.flip()
clock.tick(60)









share|improve this question




















  • 3





    Your title asks about creating a GIF, but your question is how to use it. Also, "schemes to not work" may be factually correct but it does not help us visualizing what you are encountering. Finally: are the contents of your gif files an important factor of your problems? If so, please provide a link. If the actual images are not part of the problem, you could perhaps change your code to draw simple rectangles instead.

    – usr2564301
    Nov 24 '18 at 13:16











  • @Will.2004 what exactly happens when you load the gif? Do you get an error message? Is the gif animated or just a static image? You could add the gif to the question, so that we can try to run your code.

    – skrx
    Nov 24 '18 at 15:18













  • @skrx No it just loads onto the screen and acts the same way as a picture

    – user10632736
    Nov 24 '18 at 20:37











  • Could you add the gif to the question? Or have you already fixed the problem? I've checked out the code with one of my images and it seems to work correctly (the images are visible).

    – skrx
    Nov 25 '18 at 1:25











  • The gif goes onto the screen but doesn't move like gifs are supposed to

    – user10632736
    Nov 25 '18 at 11:35














0












0








0








I have tried to make a GIF work by using pygame.image.load but it seems not to work. The image is in the player_1 class and the object is called player_one. The draw function blits the picture at the xpos and the ypos. Can you please try and show me how I can swap the blit in the draw function with something else and how to use the draw function in the while loop?



import pygame
import random
import sys

pygame.init()
screen = pygame.display.set_mode((1280, 720))
clock = pygame.time.Clock() # A clock to limit the frame rate.
pygame.display.set_caption("this game")


class Background:
picture = pygame.image.load("C:/images/cliff.jpg").convert()
picture = pygame.transform.scale(picture, (1280, 720))

def __init__(self, x, y):
self.xpos = x
self.ypos = y

def draw(self):
screen.blit(self.picture, (self.xpos, self.ypos))


class player_1:
picture = pygame.image.load("C:/aliens/Giantmechanicalcrab2.gif")
picture = pygame.transform.scale(picture, (200, 200))

def __init__(self, x, y):
self.ypos = y
self.xpos = x
self.speed_x = 0
self.speed_y = 0
self.rect = self.picture.get_rect()


def update(self):
self.xpos =+ self.speed_x
self.ypos =+ self.speed_y

def draw(self): #left right
#screen.blit(pygame.transform.flip(self.picture, True, False), self.rect)
screen.blit(self.picture, (self.xpos, self.ypos))




class player_2:
picture = pygame.image.load("C:/aliens/Giantmechanicalcrab2.gif")
picture = pygame.transform.scale(picture, (200, 200))
def __init__(self, x, y):
self.ypos = y
self.xpos = x
self.speed_x = 0
self.speed_y = 0
self.rect = self.picture.get_rect()

def update(self):
self.xpos =+ self.speed_x
self.ypos =+ self.speed_y

def draw(self):
screen.blit(self.picture, (self.xpos, self.ypos))
#screen.blit(pygame.transform.flip(self.picture, True, False), self.rect)


class Bullet_player_1(pygame.sprite.Sprite):
picture = pygame.image.load("C:/aliens/giphy.gif").convert_alpha()
picture = pygame.transform.scale(picture, (100, 100))


def __init__(self):
self.xpos = 360
self.ypos = 360
self.speed_x = 0
super().__init__()
self.rect = self.picture.get_rect()


def update(self):
self.xpos += self.speed_x

def draw(self):
screen.blit(self.picture, (self.xpos, self.ypos))
#self.screen.blit(pygame.transform.flip(self.picture, False, True), self.rect)

def is_collided_with(self, sprite):
return self.rect.colliderect(sprite.rect)





class Bullet_player_2(pygame.sprite.Sprite):
picture = pygame.image.load("C:/aliens/MajesticLavishBackswimmer-size_restricted.gif").convert_alpha()
picture = pygame.transform.scale(picture, (100, 100))


def __init__(self):
self.xpos = 360
self.ypos = 360
self.speed_x = 0
super().__init__()
self.rect = self.picture.get_rect()


def update(self):
self.xpos -= self.speed_x

def draw(self):
screen.blit(self.picture, (self.xpos, self.ypos))
#self.screen.blit(pygame.transform.flip(self.picture, True, False), self.rect)

def is_collided_with(self, sprite):
return self.rect.colliderect(sprite.rect)




bullet_list = pygame.sprite.Group()
#player_two_bullet_list = pygame.sprite.Group()
player_one = player_1(0, 0)
#player_two = player_2(0, 720)
cliff = Background(0, 0)

while True:
for event in pygame.event.get():
if event.type == pygame.QUIT:
pygame.quit()
sys.exit()

elif event.type == pygame.KEYDOWN:
if event.key == pygame.K_w:
player_one.speed_y = -5

elif event.key == pygame.K_s:
player_one.speed_y = 5

#elif event.key == pygame.K_UP:
#player_two.speed_y = -5

#elif event.key == pygame.K_DOWN:
#player_two.speed_y = 5


elif event.key == pygame.K_SPACE:
bullet = Bullet_player_1

bullet.ypos = player_one.ypos
bullet.xpos = player_one.xpos

bullet.speed_x = 14

bullet_list.add(bullet)


#elif event.key == pygame.K_KP0:
#bullet_player_two = Bullet_player_2

#bullet_player_two.ypos = player_two.ypos
#bullet_player_two.xpos = player_two.xpos

#bullet_player_two.speed_x = 14

#player_two_bullet_list.add(bullet_player_two)


elif event.type == pygame.KEYUP:
if event.key == pygame.K_d and player_one.speed_x > 0:
player_one.speed_x = 0
elif event.key == pygame.K_a and player_one.speed_x < 0:
player_one.speed_x = 0


#elif event.key == pygame.K_UP and player_two.speed_x > 0:
#player_two.speed_x = 0
#elif event.key == pygame.K_DOWN and player_two.speed_x < 0:
#player_two.speed_x = 0


player_one.update()
#player_two.update()
cliff.draw()
player_one.draw()
#player_two.draw()

bullet_list.update()
#player_two_bullet_list.update()

for bullete in bullet_list:
bullet.draw()


#for bullet_player_two in player_two_bullet_list:
#bullet_player_two.draw()


pygame.display.flip()
clock.tick(60)









share|improve this question
















I have tried to make a GIF work by using pygame.image.load but it seems not to work. The image is in the player_1 class and the object is called player_one. The draw function blits the picture at the xpos and the ypos. Can you please try and show me how I can swap the blit in the draw function with something else and how to use the draw function in the while loop?



import pygame
import random
import sys

pygame.init()
screen = pygame.display.set_mode((1280, 720))
clock = pygame.time.Clock() # A clock to limit the frame rate.
pygame.display.set_caption("this game")


class Background:
picture = pygame.image.load("C:/images/cliff.jpg").convert()
picture = pygame.transform.scale(picture, (1280, 720))

def __init__(self, x, y):
self.xpos = x
self.ypos = y

def draw(self):
screen.blit(self.picture, (self.xpos, self.ypos))


class player_1:
picture = pygame.image.load("C:/aliens/Giantmechanicalcrab2.gif")
picture = pygame.transform.scale(picture, (200, 200))

def __init__(self, x, y):
self.ypos = y
self.xpos = x
self.speed_x = 0
self.speed_y = 0
self.rect = self.picture.get_rect()


def update(self):
self.xpos =+ self.speed_x
self.ypos =+ self.speed_y

def draw(self): #left right
#screen.blit(pygame.transform.flip(self.picture, True, False), self.rect)
screen.blit(self.picture, (self.xpos, self.ypos))




class player_2:
picture = pygame.image.load("C:/aliens/Giantmechanicalcrab2.gif")
picture = pygame.transform.scale(picture, (200, 200))
def __init__(self, x, y):
self.ypos = y
self.xpos = x
self.speed_x = 0
self.speed_y = 0
self.rect = self.picture.get_rect()

def update(self):
self.xpos =+ self.speed_x
self.ypos =+ self.speed_y

def draw(self):
screen.blit(self.picture, (self.xpos, self.ypos))
#screen.blit(pygame.transform.flip(self.picture, True, False), self.rect)


class Bullet_player_1(pygame.sprite.Sprite):
picture = pygame.image.load("C:/aliens/giphy.gif").convert_alpha()
picture = pygame.transform.scale(picture, (100, 100))


def __init__(self):
self.xpos = 360
self.ypos = 360
self.speed_x = 0
super().__init__()
self.rect = self.picture.get_rect()


def update(self):
self.xpos += self.speed_x

def draw(self):
screen.blit(self.picture, (self.xpos, self.ypos))
#self.screen.blit(pygame.transform.flip(self.picture, False, True), self.rect)

def is_collided_with(self, sprite):
return self.rect.colliderect(sprite.rect)





class Bullet_player_2(pygame.sprite.Sprite):
picture = pygame.image.load("C:/aliens/MajesticLavishBackswimmer-size_restricted.gif").convert_alpha()
picture = pygame.transform.scale(picture, (100, 100))


def __init__(self):
self.xpos = 360
self.ypos = 360
self.speed_x = 0
super().__init__()
self.rect = self.picture.get_rect()


def update(self):
self.xpos -= self.speed_x

def draw(self):
screen.blit(self.picture, (self.xpos, self.ypos))
#self.screen.blit(pygame.transform.flip(self.picture, True, False), self.rect)

def is_collided_with(self, sprite):
return self.rect.colliderect(sprite.rect)




bullet_list = pygame.sprite.Group()
#player_two_bullet_list = pygame.sprite.Group()
player_one = player_1(0, 0)
#player_two = player_2(0, 720)
cliff = Background(0, 0)

while True:
for event in pygame.event.get():
if event.type == pygame.QUIT:
pygame.quit()
sys.exit()

elif event.type == pygame.KEYDOWN:
if event.key == pygame.K_w:
player_one.speed_y = -5

elif event.key == pygame.K_s:
player_one.speed_y = 5

#elif event.key == pygame.K_UP:
#player_two.speed_y = -5

#elif event.key == pygame.K_DOWN:
#player_two.speed_y = 5


elif event.key == pygame.K_SPACE:
bullet = Bullet_player_1

bullet.ypos = player_one.ypos
bullet.xpos = player_one.xpos

bullet.speed_x = 14

bullet_list.add(bullet)


#elif event.key == pygame.K_KP0:
#bullet_player_two = Bullet_player_2

#bullet_player_two.ypos = player_two.ypos
#bullet_player_two.xpos = player_two.xpos

#bullet_player_two.speed_x = 14

#player_two_bullet_list.add(bullet_player_two)


elif event.type == pygame.KEYUP:
if event.key == pygame.K_d and player_one.speed_x > 0:
player_one.speed_x = 0
elif event.key == pygame.K_a and player_one.speed_x < 0:
player_one.speed_x = 0


#elif event.key == pygame.K_UP and player_two.speed_x > 0:
#player_two.speed_x = 0
#elif event.key == pygame.K_DOWN and player_two.speed_x < 0:
#player_two.speed_x = 0


player_one.update()
#player_two.update()
cliff.draw()
player_one.draw()
#player_two.draw()

bullet_list.update()
#player_two_bullet_list.update()

for bullete in bullet_list:
bullet.draw()


#for bullet_player_two in player_two_bullet_list:
#bullet_player_two.draw()


pygame.display.flip()
clock.tick(60)






python pygame gif






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Nov 24 '18 at 15:14









skrx

15.7k31834




15.7k31834










asked Nov 24 '18 at 13:12







user10632736















  • 3





    Your title asks about creating a GIF, but your question is how to use it. Also, "schemes to not work" may be factually correct but it does not help us visualizing what you are encountering. Finally: are the contents of your gif files an important factor of your problems? If so, please provide a link. If the actual images are not part of the problem, you could perhaps change your code to draw simple rectangles instead.

    – usr2564301
    Nov 24 '18 at 13:16











  • @Will.2004 what exactly happens when you load the gif? Do you get an error message? Is the gif animated or just a static image? You could add the gif to the question, so that we can try to run your code.

    – skrx
    Nov 24 '18 at 15:18













  • @skrx No it just loads onto the screen and acts the same way as a picture

    – user10632736
    Nov 24 '18 at 20:37











  • Could you add the gif to the question? Or have you already fixed the problem? I've checked out the code with one of my images and it seems to work correctly (the images are visible).

    – skrx
    Nov 25 '18 at 1:25











  • The gif goes onto the screen but doesn't move like gifs are supposed to

    – user10632736
    Nov 25 '18 at 11:35














  • 3





    Your title asks about creating a GIF, but your question is how to use it. Also, "schemes to not work" may be factually correct but it does not help us visualizing what you are encountering. Finally: are the contents of your gif files an important factor of your problems? If so, please provide a link. If the actual images are not part of the problem, you could perhaps change your code to draw simple rectangles instead.

    – usr2564301
    Nov 24 '18 at 13:16











  • @Will.2004 what exactly happens when you load the gif? Do you get an error message? Is the gif animated or just a static image? You could add the gif to the question, so that we can try to run your code.

    – skrx
    Nov 24 '18 at 15:18













  • @skrx No it just loads onto the screen and acts the same way as a picture

    – user10632736
    Nov 24 '18 at 20:37











  • Could you add the gif to the question? Or have you already fixed the problem? I've checked out the code with one of my images and it seems to work correctly (the images are visible).

    – skrx
    Nov 25 '18 at 1:25











  • The gif goes onto the screen but doesn't move like gifs are supposed to

    – user10632736
    Nov 25 '18 at 11:35








3




3





Your title asks about creating a GIF, but your question is how to use it. Also, "schemes to not work" may be factually correct but it does not help us visualizing what you are encountering. Finally: are the contents of your gif files an important factor of your problems? If so, please provide a link. If the actual images are not part of the problem, you could perhaps change your code to draw simple rectangles instead.

– usr2564301
Nov 24 '18 at 13:16





Your title asks about creating a GIF, but your question is how to use it. Also, "schemes to not work" may be factually correct but it does not help us visualizing what you are encountering. Finally: are the contents of your gif files an important factor of your problems? If so, please provide a link. If the actual images are not part of the problem, you could perhaps change your code to draw simple rectangles instead.

– usr2564301
Nov 24 '18 at 13:16













@Will.2004 what exactly happens when you load the gif? Do you get an error message? Is the gif animated or just a static image? You could add the gif to the question, so that we can try to run your code.

– skrx
Nov 24 '18 at 15:18







@Will.2004 what exactly happens when you load the gif? Do you get an error message? Is the gif animated or just a static image? You could add the gif to the question, so that we can try to run your code.

– skrx
Nov 24 '18 at 15:18















@skrx No it just loads onto the screen and acts the same way as a picture

– user10632736
Nov 24 '18 at 20:37





@skrx No it just loads onto the screen and acts the same way as a picture

– user10632736
Nov 24 '18 at 20:37













Could you add the gif to the question? Or have you already fixed the problem? I've checked out the code with one of my images and it seems to work correctly (the images are visible).

– skrx
Nov 25 '18 at 1:25





Could you add the gif to the question? Or have you already fixed the problem? I've checked out the code with one of my images and it seems to work correctly (the images are visible).

– skrx
Nov 25 '18 at 1:25













The gif goes onto the screen but doesn't move like gifs are supposed to

– user10632736
Nov 25 '18 at 11:35





The gif goes onto the screen but doesn't move like gifs are supposed to

– user10632736
Nov 25 '18 at 11:35












0






active

oldest

votes











Your Answer






StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");

StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});

function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});


}
});














draft saved

draft discarded


















StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53458495%2fcreating-a-gif-in-pygame%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown
























0






active

oldest

votes








0






active

oldest

votes









active

oldest

votes






active

oldest

votes
















draft saved

draft discarded




















































Thanks for contributing an answer to Stack Overflow!


  • Please be sure to answer the question. Provide details and share your research!

But avoid



  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.


To learn more, see our tips on writing great answers.




draft saved


draft discarded














StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53458495%2fcreating-a-gif-in-pygame%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







Popular posts from this blog

Tonle Sap (See)

I get strange results when I access the Sqlitedatabase with Unity C# via XAMPP

Guatemaltekische Davis-Cup-Mannschaft