Moving picture to random location. Pygame
How do I remove the previous picture placed. So that only one picture is on the screen at once
import pygame
from random import randint
pygame.init()
ekraan = pygame.display.set_mode([640, 480])
ekraan.fill([255,255,255])
tootab = True
waldo = pygame.image.load("wwaldo.jpg")
ekraan.blit(waldo, (50,50))
pygame.display.flip()
while tootab:
for i in pygame.event.get():
if i.type == pygame.QUIT:
tootab = False
elif i.type == pygame.MOUSEBUTTONUP:
x = randint(0,640)
y = randint(0,480)
ekraan.blit(waldo, (x,y))
pygame.display.flip()
pygame.quit()
Posted Apr 26, 2017, 5:48 PM UTC
00