demos/03_event.py
author Radek Brich <radek.brich@devl.cz>
Sat, 21 Feb 2015 12:01:57 +0100
changeset 118 8c7970520632
child 119 dd91747504dd
permissions -rwxr-xr-x
Add mouse events, event demo.

#!/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