--- a/demos/02_curses.py Sat Mar 15 14:43:47 2014 +0100
+++ b/demos/02_curses.py Sat Mar 15 15:28:20 2014 +0100
@@ -7,6 +7,11 @@
from tuikit.driver.curses import CursesDriver
+colors = ('blue', 'green', 'cyan', 'red',
+ 'magenta', 'brown', 'lightgray', 'gray',
+ 'lightblue', 'lightgreen', 'lightcyan', 'lightred',
+ 'lightmagenta', 'yellow', 'white')
+
buffer = Buffer(16, 8)
buffer.fill(c='#')
buffer.hline(1, 1, 14, c='-')
@@ -15,12 +20,31 @@
buffer.puts(8, 4, 'Hello!')
buffer.frame()
+buffer2 = Buffer(30, 10)
+buffer2.setattr('white on black')
+buffer2.frame()
+
+for idx, color in enumerate(colors):
+ buffer2.setattr(color)
+ buffer2.puts(3 + 12 * (idx // 8), 1 + idx % 8, color)
+
+buffer3 = Buffer(30, 10)
+buffer3.setattr('white on black')
+buffer3.frame()
+
+for idx, color in enumerate(colors[:8]):
+ buffer3.setattr('black on {}'.format(color))
+ buffer3.puts(2, 1 + idx, ' '+color.ljust(10))
+ buffer3.setattr('{}, underline, bold'.format(color))
+ buffer3.puts(15, 1 + idx, ' '+color.ljust(10))
+
+buffer3.setattr('lightgray, blink')
+buffer3.puts(3, 8, 'blink')
+
driver = CursesDriver()
with driver:
driver.draw(buffer)
- buffer.setattr('red on blue, bold')
- buffer.puts(8, 4, 'Hello!')
- driver.draw(buffer, 20, 10)
+ driver.draw(buffer2, 20, 00)
+ driver.draw(buffer3, 20, 10)
driver.flush()
driver.getevents()
-