Pygame.surface.fill() transforms image into str

Viewed 24

I‘m trying to make the basic code for a game, and for the tiles I create a pygame surface and fill them with color. Then I use get_rect to create a rectangle. But I get an error message:

AttributeError: ‘str’ object has no attribute ‘get_rect’

1 Answers

You are currently calling the get_rect() method from something you expect to be of class pygame.Surface but is actually a string. See where you assign its value and it becomes a string.

Related