def on_tick(self,secs):
     ms = secs * 1000
     s = self.this_screen
     if not s:
         self.close()
     s.step(ms)
     if s.expired():
         try:
             del self.this_screen
             s = screen.next()
             s.resize(*self.get_size())
             self.this_screen = s
         except StopIteration:
             self.close()
 def __init__(self,**kw):
     super(GameWindow,self).__init__(**kw)
     pyglet.clock.schedule(self.on_tick)
     self.this_screen = screen.next()