'Setting' object has no attribute 'blit'
时间: 2023-09-21 08:11:19 浏览: 31
This error message typically occurs when you are trying to call the `blit` method on an object that is not a surface or a sprite.
For example, if you have a `Setting` object and you are trying to blit it onto a `pygame.Surface` object like this:
```
setting = Setting()
screen = pygame.display.set_mode((800, 600))
screen.blit(setting, (0, 0))
```
You will get the error message `'Setting' object has no attribute 'blit'` because the `Setting` object does not have a `blit` method.
To fix this error, you need to make sure that you are calling the `blit` method on a surface or a sprite. For example, you could create a surface from the `Setting` object and then blit that surface onto the screen:
```
setting = Setting()
setting_surface = pygame.Surface((setting.width, setting.height))
setting_surface.blit(setting.image, (0, 0))
screen = pygame.display.set_mode((800, 600))
screen.blit(setting_surface, (0, 0))
```
In this example, we create a surface from the `Setting` object and blit its image onto that surface. Then we can blit the surface onto the screen.