[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]
Re: [pygame] pygame.error: video system not initialized
Hi Alex and Jake,
Passing the display surface around is not the problem. In fact it is
good style to keep a reference and pass it to other functions as an
argument. It lets you reuse those functions for other surfaces if you
want. I agree with Jake about seeing the complete program before
hazarding a guess. It could be something as trivial as calling
pygame.event.get() after pygame.quit():
Python 2.5.2 (r252:60911, Jan 24 2010, 14:53:14)
[GCC 4.3.2] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import pygame
>>> pygame.init()
(6, 0)
>>> win = pygame.display.set_mode((200, 100))
>>> win.fill((0, 0, 255))
<rect(0, 0, 200, 100)>
>>> pygame.display.flip()
>>> evts = pygame.event.get()
>>> pygame.quit()
>>> evts = pygame.event.get()
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
pygame.error: video system not initialized
>>>
Lenard
Jake b wrote:
Instead of passing win, use pygame.display.get_surface() , to get the
screen, and you can get the dimensions from the Surface().
I can't tell the solution without seeing more. However , take a look
at this Game() class.
http://python.pastebin.com/CV4grHzJ
It saves a reference to screen, and saves dimensions.
Game() class can contain SpriteGroup() to store your objects, and use
collision functions. Check out:
http://www.pygame.org/docs/tut/SpriteIntro.html
--
Jake