[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

[pygame] pygame.error: video system not initialized



Hi all,
I have added a lot of classes and such to my battleship game, and I am
now trying to test it before I continue. I have several hotkeys set
up, including ctrl-arrow keys. However, I am getting odd behavior with
my hotkeys; my ctrl-down, for example, switches me out of the pygame
window completely. When I hit escape to close the window, I see an
error:
pygame.error: video system not initialized.
Apparently this is an indicator that I am not initializing something,
since the error happens on the start of the for loop that watches for
events:
 for e in pygame.event.get():
However, near the top of the file holding that loop, I do:
import pygame.
from pygame.locals import *
pygame.init()
win=pygame.display.set_mode((boardRows*squareSize, boardCols*squareSize))
pygame.display.set_caption("Battleship")
board.drawBoard(win, boardRows, boardCols, squareSize) #draw a pretty
grid on the #screen

I included the last line since I am wondering if passing win to
another function could be causing problems? All the other function
does is try to draw a couple rectangles (which does not work) then
returns True. All it needs win for is to get the size so it can get a
surface to draw on.
I have also tried including the line
pygame.display.init()
but that did not change anything. TIA for any suggestions.


-- 
Have a great day,
Alex (msg sent from GMail website)
mehgcap@xxxxxxxxx; http://www.facebook.com/mehgcap