demos/03_event.py
changeset 118 8c7970520632
child 119 dd91747504dd
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/demos/03_event.py	Sat Feb 21 12:01:57 2015 +0100
@@ -0,0 +1,19 @@
+#!/usr/bin/env python3
+
+from tuikit.core.buffer import Buffer
+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)
+    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