Okay so I have created a small screen, added music, and added background and it all worked out perfectly.
But I have never gotten this before???
Traceback (most recent call last):
File "C:\Documents and Settings\Owner\Desktop\Py\Python\GameName\Grassland\grassland.py", line 57, in <module>
event = pygame.event.wait ()
error: video system not initialized
I don't get it... I have used pygame.event.wait() in earlier stuff?
Can anyone tell me why it won't work. I have even tried to use the pygame.display.init() and it still won't work?
Python: video system not initialized?
Page 1 of 12 Replies - 4343 Views - Last Post: 31 August 2008 - 05:59 PM
Replies To: Python: video system not initialized?
#2
Re: Python: video system not initialized?
Posted 31 August 2008 - 05:40 PM
Code you post the rest of your relevant code.
#3
Re: Python: video system not initialized?
Posted 31 August 2008 - 05:59 PM
Nova Dragoon, on 31 Aug, 2008 - 05:40 PM, said:
Code you post the rest of your relevant code.
import os, sys, pygame
from pygame.locals import *
class TSOH:
def __init__(self, width=643,height=460):
#Initialize Pygame
pygame.init()
pygame.display.init()
self.width = width
self.height = height
self.screen = pygame.display.set_mode((self.width, self.height))
pygame.display.set_caption('2D game')
def MainLoop(self):
self.LoadSprites();
pygame.key.set_repeat(500, 30)
self.background = pygame.Surface(self.screen.get_size())
self.background = self.background.convert()
self.background.fill((0, 0, 0))
self.screen.blit(self.background, (0, 0))
self.hero_sprites.draw(self.screen)
pygame.display.flip()
class Hero(pygame.sprite.Sprite):
def __init__(self):
pygame.sprite.Sprite.__init__(self)
self.image, self.rect = load_image('hero.bmp',-1)
self,y_dist = 10
self,x_dist = 10
def move(self, key):
xMove = 0;
yMove = 0;
if (key == K_D):
xMove = self.x_dist
elif (key == K_A):
xMove == -self.x_dist
elif (key == K_W):
yMove == self.y_dist
elif (key == K_S):
yMove == -self.y_dist
self.rect.move_ip(xMove,yMove)
running = True
while running:
event = pygame.event.wait ()
if event.type == pygame.QUIT:
running = False
pygame.quit()
Page 1 of 1
|
|

New Topic/Question
Reply




MultiQuote




|