How can i adjust my image in a window in python?

Viewed 55

i'm a student and my task is that i must create a moving image in a window. I want my image to move from the left to the bottom en then to the right (using pygame). I've found a perfect image but it is too large so it can only move it to the left. I really want to use that picture but i don't really know how to make it smaller. Can anybody help me please? This is my image

enter image description here

and this is my code

import pygame

pygame.init()
width = 800;
height = 800

screen = pygame.display.set_mode((width, height))
redSquare = pygame.image.load("wololo.jpg").convert()
fpsClock = pygame.time.Clock()
imageX = 200;  # x coordnate of image
imageY = 30;  # y coordinate of image
running = True
black = (0, 0, 0)
while (running):  # main game loop
    imageX -= 20;
    screen.fill(black)  # clear screen
    screen.blit(redSquare, (imageX, imageY))  # paint to screen
    for event in pygame.event.get():
        if event.type == pygame.QUIT:
            running = False
        if event.type == pygame.MOUSEBUTTONDOWN:
            # Set the x, y postions of the mouse click
            x, y = event.pos
    pygame.display.update()
    fpsClock.tick(30)
# loop over, quite pygame
pygame.quit()
1 Answers
Related