demos/02_curses.py
author Radek Brich <radek.brich@devl.cz>
Sat, 15 Mar 2014 14:43:47 +0100
changeset 84 04dfb5ddf031
parent 83 ebe732b9ef19
child 85 6828c5b16087
permissions -rwxr-xr-x
Refactor Driver, CursesDriver: draw, setattr, input.

#!/usr/bin/env python3

import sys
sys.path.append('..')

from tuikit.core.buffer import Buffer
from tuikit.driver.curses import CursesDriver


buffer = Buffer(16, 8)
buffer.fill(c='#')
buffer.hline(1, 1, 14, c='-')
buffer.hline(1, 6, 14, c='-')
buffer.vline(7, 2, 4, c='|')
buffer.puts(8, 4, 'Hello!')
buffer.frame()

driver = CursesDriver()
with driver:
    driver.draw(buffer)
    buffer.setattr('red on blue, bold')
    buffer.puts(8, 4, 'Hello!')
    driver.draw(buffer, 20, 10)
    driver.flush()
    driver.getevents()