demos/03_event.py
changeset 119 dd91747504dd
parent 118 8c7970520632
--- a/demos/03_event.py	Sat Feb 21 12:01:57 2015 +0100
+++ b/demos/03_event.py	Sun Feb 22 09:53:13 2015 +0100
@@ -4,16 +4,16 @@
 from tuikit.driver.cursesw import CursesWDriver
 
 buffer = Buffer()
-line = 0
 with CursesWDriver() as driver:
     buffer.resize(*driver.size)
-    buffer.puts(str(driver.size), 0, 10)
+    buffer.puts("Press a key or mouse button. Ctrl-C to exit.", 0, 0)
+    line = 1
     while True:
-        for event in driver.getevents():
-            buffer.puts(str(event), 0, line)
-            line += 1
         driver.draw(buffer)
         driver.flush()
         if line >= buffer.size.h:
             buffer.fill()
             line = 0
+        for event in driver.getevents():
+            buffer.puts(str(event), 0, line)
+            line += 1