demos/03_event.py
changeset 118 8c7970520632
child 119 dd91747504dd
equal deleted inserted replaced
117:8680c2333546 118:8c7970520632
       
     1 #!/usr/bin/env python3
       
     2 
       
     3 from tuikit.core.buffer import Buffer
       
     4 from tuikit.driver.cursesw import CursesWDriver
       
     5 
       
     6 buffer = Buffer()
       
     7 line = 0
       
     8 with CursesWDriver() as driver:
       
     9     buffer.resize(*driver.size)
       
    10     buffer.puts(str(driver.size), 0, 10)
       
    11     while True:
       
    12         for event in driver.getevents():
       
    13             buffer.puts(str(event), 0, line)
       
    14             line += 1
       
    15         driver.draw(buffer)
       
    16         driver.flush()
       
    17         if line >= buffer.size.h:
       
    18             buffer.fill()
       
    19             line = 0