0

All I'm trying to do is load a picture like it is a background, and it keeps giving the same error.

This is my code:

import pygame, sys,os
from pygame.locals import * 
pygame.init()


background = os.path.join("\\\A-FS-02\Home$\ytsmaj\My Documents\ICS 201\Stuff With Pygame\ISU\slotbackroundfit.png")

backround_surface = pygame.image.load(background)

backgroundRect = background.get_rect()
size = (width, height) = background.get_size(584, 648)
screen = pygame.display.set_mode(size)

And this is the error I get:

Traceback (most recent call last):
 File "\\A-FS-02\Home$\ytsmaj\My Documents\ICS 201\Stuff With Pygame\ISU\slotmachinetest.py", line 10, in <module>
backgroundRect = background.get_rect()
AttributeError: 'str' object has no attribute 'get_rect'

I don't really know what is wrong because I'm new with pygame.

jonrsharpe
  • 115,751
  • 26
  • 228
  • 437
Jacob Y
  • 1
  • 2

0 Answers0