from pyglet import window
from pyglet import text
from pyglet import clock
from pyglet import font

w = window.Window(fullscreen=True)

class Timer(text.Label):
    def stop(self):
        self.__time = 0
    def reset(self):
        self.__time = 0
        self.__running = False
        self.text = '00:00'
    def animate(self, dt):
        if self.__running:
            self.__time += dt
            m, s = divmod(self.__time, 60)
            self.text = '%02d:%02d'%(m, s)

    def on_text(self, text):
        if text == ' ':
            self.__running = not self.__running
            return True
        return False

ft = font.load('', 360)
timer = Timer('00:00', ft, x=w.width//2, y=w.height//2,
    valign='center', halign='center')
timer.reset()
clock.schedule(timer.animate)
w.push_handlers(timer)

while not w.has_exit:
    w.dispatch_events()
    clock.tick()
    w.clear()
    timer.draw()
    w.flip()


@@ -1,108 +1,284 @@
-from pyglet impor
+'''A full-screen minute:second timer.  Leave i
 t 
-w
 in
-dow%0Afrom pyglet import text%0Afrom pyglet import clock%0Afrom pyglet import font%0A%0Aw = 
+ charge of your conference%0Alighting talks.%0A%0AAfter 5 minutes, the timer goes red.  This limit is easily adjustable by%0Ahacking the source code.%0A%0APress spacebar to start, stop and reset the timer.%0A'''%0A%0Aimport pyglet%0A%0Awindow = pyglet.
 wind
@@ -321,18 +321,14 @@
 mer(
-text.Label
+object
 ):%0A 
@@ -334,20 +334,24 @@
     def 
-stop
+__init__
 (self):%0A
@@ -359,34 +359,247 @@
        self.
-__time = 0
+label = pyglet.text.Label('00:00', font_size=360, %0A                                       x=window.width//2, y=window.height//2,%0A                                       valign='center', halign='center')%0A        self.reset()%0A
 %0A    def res
@@ -617,26 +617,24 @@
        self.
-__
 time = 0%0A   
@@ -635,34 +635,32 @@
  0%0A        self.
-__
 running = False%0A
@@ -664,32 +664,38 @@
 se%0A        self.
+label.
 text = '00:00'%0A 
@@ -701,16 +701,64 @@
     
-def anim
+    self.label.color = (255, 255, 255, 255)%0A%0A    def upd
 ate(
@@ -780,26 +780,24 @@
     if self.
-__
 running:%0A   
@@ -806,26 +806,24 @@
        self.
-__
 time += dt%0A 
@@ -852,18 +852,16 @@
 od(self.
-__
 time, 60
@@ -879,16 +879,22 @@
    self.
+label.
 text = '
@@ -907,117 +907,211 @@
 02d'
-%25
+ %25 
 (m, s)%0A
-%0A
     
-def on_text(self, text):%0A        if text == ' ':%0A            self.__running = not self.__
+        if m %3E= 5:%0A                self.label.color = (180, 0, 0, 255)%0A@window.event%0Adef on_key_press(symbol, modifiers):%0A    if symbol == pyglet.window.key.SPACE:%0A        if timer.
 running
+:
 %0A   
@@ -1123,295 +1123,267 @@
     
-return True%0A        return False%0A%0Aft = font.load('', 360)%0Atimer = Timer('00:00', ft, x=w.width//2, y=w.height//2,%0A    valign='center', halign='center')%0Atimer.reset()%0Aclock.schedule(timer.animate)%0Aw.push_handlers(timer)%0A%0Awhile not w.has_exit:%0A    w.dispatch_events()%0A    clock.tick
+timer.running = False%0A        else:%0A            if timer.time %3E 0:%0A                timer.reset()%0A            else:%0A                timer.running = True%0A    elif symbol == pyglet.window.key.ESCAPE:%0A        window.close()%0A%0A@window.event%0Adef on_draw
 ()
+:
 %0A    
+windo
 w.cl
@@ -1402,25 +1402,100 @@
 mer.
+label.
 draw()%0A
-    w.flip
+%0Atimer = Timer()%0Apyglet.clock.schedule_interval(timer.update, 1)%0Apyglet.app.run
 ()%0A%0A

Update timer for new label. Clean up a bit and use more pyglet 1.1 features.