Pygame image not blitting to surface

Question:

This is my first or second attempt (im not sure) at trying to use an image in pygame, and the image im using isnt blitting onto the surface no matter what i try, please help.

Game Folder

import pygame
import random
import os

pygame.mixer.init()

def Main():
    PATH = os.path.join(os.path.dirname(os.path.abspath(__file__)) + 'Assets')
    print(PATH)
    WINDOW = pygame.display.set_mode((700, 700))

    Diamond = pygame.image.load(PATH + 'ImagesDiamond.png')
    PickupSound = pygame.mixer.Sound(PATH + 'AudioCollectDiamond.wav')
    pygame.mixer.Sound.play(PickupSound)

    while True:
        WINDOW.fill((125, 125, 200))
        Diamond.blit(WINDOW, (200, 200))
        pygame.display.update()

Main()
Asked By: SquidR

||

Answers:

Testing out your initial code, I believe you need to basically correct one line. Instead of:

Diamond.blit(WINDOW, (200, 200))

The line of code should be:

WINDOW.blit(Diamond, (200, 200))

When I went out and grabbed a generic "png" file, I got the following sample screen.

Diamond

Give that a try.

Answered By: NoDakker
Categories: questions Tags: , ,
Answers are sorted by their score. The answer accepted by the question owner as the best is marked with
at the top-right corner.