so I get this error when I try to run my pygame code: pygame.error: video system not initialized
i specify where the wing IDE tells me it is in the code below
You haven't called pygame.init() anywhere.
See the basic Intro tutorial, or the specific Import and Initialize tutorial, which explains:
Before you can do much with pygame, you will need to initialize it. The most common way to do this is just make one call.
pygame.init()
This will attempt to initialize all the pygame modules for you. Not all pygame modules need to be initialized, but this will automatically initialize the ones that do. You can also easily initialize each pygame module by hand. For example to only initialize the font module you would just call.
In your particular case, it's probably pygame.display that's complaining that you called either its set_caption
or its flip
without calling its init
first. But really, as the tutorial says, it's better to just init
everything at the top than to try to figure out exactly what needs to be initialized when.
pygame.init()
then solve the problem video system initialized.
but you get the next error like:(
AttributeError: tuple object has no attribute 'fill'
) this.
screen = pygame.display.set_mode((600, 400))
but not doing like
screen = screen_width, screen_height = 600, 400