2 Replies - 5145 Views - Last Post: 31 August 2008 - 05:59 PM Rate Topic: -----

#1 Solid  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 23
  • Joined: 29-August 08

Python: video system not initialized?

Posted 31 August 2008 - 03:03 PM

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?

Is This A Good Question/Topic? 0
  • +

Replies To: Python: video system not initialized?

#2 Nova Dragoon  Icon User is offline

  • The Innocent Shall Suffer, Big Time
  • member icon

Reputation: 36
  • View blog
  • Posts: 6,169
  • Joined: 16-August 01

Re: Python: video system not initialized?

Posted 31 August 2008 - 05:40 PM

Code you post the rest of your relevant code.
Was This Post Helpful? 0
  • +
  • -

#3 Solid  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 23
  • Joined: 29-August 08

Re: Python: video system not initialized?

Posted 31 August 2008 - 05:59 PM

View PostNova 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()



Was This Post Helpful? 0
  • +
  • -

Page 1 of 1