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

Re: [pygame] Event Stack Weirdness



Kris Schnee wrote:
I encountered a strange bug. I'm using my "ringtale" game framework, which uses a stack of game states. It looks something like this:

class Framework:
    def __init__(self):
        self.states = []
    def Push(self,state):
        self.states.append(state)
    def Pop(self):
        if self.states:
            self.states.pop()
        else:
            raise "No states to pop!"
    def Loop(self):
        ## Based on current state, run logic and drawing functions.
        ## If certain stuff happens, pop the current state.


Now, if I load my game in IDLE, it runs. If I then run it _again_ without closing IDLE, it crashes, giving the no-states-to-pop message! Closing and restarting IDLE lets it work again.

pygame.quit() must be explicitly called since atexit functions are not executed until IDLE's nteractive interpreter is either closed or restarted.

--
Lenard Lindstrom
<len-l@xxxxxxxxx>