demos/01_buffer.py
author Radek Brich <radek.brich@devl.cz>
Sun, 22 Feb 2015 09:53:13 +0100
changeset 119 dd91747504dd
parent 117 8680c2333546
permissions -rwxr-xr-x
Redraw widgets on request. Add scrollbar demo.
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
78
6031e99c8ad3 Add Buffer class with basic drawing methods.
Radek Brich <radek.brich@devl.cz>
parents:
diff changeset
     1
#!/usr/bin/env python3
6031e99c8ad3 Add Buffer class with basic drawing methods.
Radek Brich <radek.brich@devl.cz>
parents:
diff changeset
     2
6031e99c8ad3 Add Buffer class with basic drawing methods.
Radek Brich <radek.brich@devl.cz>
parents:
diff changeset
     3
from tuikit.core.buffer import Buffer
83
ebe732b9ef19 Refactor Driver, CursesDriver: init, close, draw.
Radek Brich <radek.brich@devl.cz>
parents: 81
diff changeset
     4
from tuikit.driver.driver import Driver
78
6031e99c8ad3 Add Buffer class with basic drawing methods.
Radek Brich <radek.brich@devl.cz>
parents:
diff changeset
     5
6031e99c8ad3 Add Buffer class with basic drawing methods.
Radek Brich <radek.brich@devl.cz>
parents:
diff changeset
     6
83
ebe732b9ef19 Refactor Driver, CursesDriver: init, close, draw.
Radek Brich <radek.brich@devl.cz>
parents: 81
diff changeset
     7
buffer = Buffer(16, 8)
95
05392e369ede Refactoring: Swap drawing operations parameters. Coords are now last and have default values.
Radek Brich <radek.brich@devl.cz>
parents: 92
diff changeset
     8
buffer.fill('#')
05392e369ede Refactoring: Swap drawing operations parameters. Coords are now last and have default values.
Radek Brich <radek.brich@devl.cz>
parents: 92
diff changeset
     9
buffer.hline('-', 1, 1, 14)
05392e369ede Refactoring: Swap drawing operations parameters. Coords are now last and have default values.
Radek Brich <radek.brich@devl.cz>
parents: 92
diff changeset
    10
buffer.hline('-', 1, 6, 14)
05392e369ede Refactoring: Swap drawing operations parameters. Coords are now last and have default values.
Radek Brich <radek.brich@devl.cz>
parents: 92
diff changeset
    11
buffer.vline('|', 7, 2, 4)
05392e369ede Refactoring: Swap drawing operations parameters. Coords are now last and have default values.
Radek Brich <radek.brich@devl.cz>
parents: 92
diff changeset
    12
buffer.puts('Hello!', 8, 4)
83
ebe732b9ef19 Refactor Driver, CursesDriver: init, close, draw.
Radek Brich <radek.brich@devl.cz>
parents: 81
diff changeset
    13
buffer.frame()
78
6031e99c8ad3 Add Buffer class with basic drawing methods.
Radek Brich <radek.brich@devl.cz>
parents:
diff changeset
    14
83
ebe732b9ef19 Refactor Driver, CursesDriver: init, close, draw.
Radek Brich <radek.brich@devl.cz>
parents: 81
diff changeset
    15
driver = Driver()
ebe732b9ef19 Refactor Driver, CursesDriver: init, close, draw.
Radek Brich <radek.brich@devl.cz>
parents: 81
diff changeset
    16
driver.init()
ebe732b9ef19 Refactor Driver, CursesDriver: init, close, draw.
Radek Brich <radek.brich@devl.cz>
parents: 81
diff changeset
    17
driver.draw(buffer)
ebe732b9ef19 Refactor Driver, CursesDriver: init, close, draw.
Radek Brich <radek.brich@devl.cz>
parents: 81
diff changeset
    18
driver.close()
ebe732b9ef19 Refactor Driver, CursesDriver: init, close, draw.
Radek Brich <radek.brich@devl.cz>
parents: 81
diff changeset
    19