10 'magenta', 'brown', 'lightgray', 'gray', |
10 'magenta', 'brown', 'lightgray', 'gray', |
11 'lightblue', 'lightgreen', 'lightcyan', 'lightred', |
11 'lightblue', 'lightgreen', 'lightcyan', 'lightred', |
12 'lightmagenta', 'yellow', 'white') |
12 'lightmagenta', 'yellow', 'white') |
13 |
13 |
14 buffer = Buffer(16, 8) |
14 buffer = Buffer(16, 8) |
15 buffer.fill(c='#') |
15 buffer.fill('#') |
16 buffer.hline(1, 1, 14, c='-') |
16 buffer.hline('-', 1, 1, 14) |
17 buffer.hline(1, 6, 14, c='-') |
17 buffer.hline('-', 1, 6, 14) |
18 buffer.vline(7, 2, 4, c='|') |
18 buffer.vline('|', 7, 2, 4) |
19 buffer.puts(8, 4, 'Hello!') |
19 buffer.puts('Hello!', 8, 4) |
20 buffer.frame() |
20 buffer.frame() |
21 |
21 |
22 buffer2 = Buffer(30, 10) |
22 buffer2 = Buffer(30, 10) |
23 buffer2.setattr('white on black') |
23 buffer2.setattr('white on black') |
24 buffer2.frame() |
24 buffer2.frame() |
25 |
25 |
26 for idx, color in enumerate(colors): |
26 for idx, color in enumerate(colors): |
27 buffer2.setattr(color) |
27 buffer2.setattr(color) |
28 buffer2.puts(3 + 12 * (idx // 8), 1 + idx % 8, color) |
28 buffer2.puts(color, 3 + 12 * (idx // 8), 1 + idx % 8) |
29 |
29 |
30 buffer3 = Buffer(30, 10) |
30 buffer3 = Buffer(30, 10) |
31 buffer3.setattr('white on black') |
31 buffer3.setattr('white on black') |
32 buffer3.frame() |
32 buffer3.frame() |
33 |
33 |
34 for idx, color in enumerate(colors[:8]): |
34 for idx, color in enumerate(colors[:8]): |
35 buffer3.setattr('black on {}'.format(color)) |
35 buffer3.setattr('black on {}'.format(color)) |
36 buffer3.puts(2, 1 + idx, ' '+color.ljust(10)) |
36 buffer3.puts(' '+color.ljust(10), 2, 1 + idx) |
37 buffer3.setattr('{}, underline, bold'.format(color)) |
37 buffer3.setattr('{}, underline, bold'.format(color)) |
38 buffer3.puts(15, 1 + idx, ' '+color.ljust(10)) |
38 buffer3.puts(' '+color.ljust(10), 15, 1 + idx) |
39 |
39 |
40 buffer3.setattr('lightgray, blink') |
40 buffer3.setattr('lightgray, blink') |
41 buffer3.puts(3, 8, 'blink') |
41 buffer3.puts('blink', 3, 8) |
42 |
42 |
43 driver = CursesDriver() |
43 driver = CursesDriver() |
44 with driver: |
44 with driver: |
45 driver.draw(buffer) |
45 driver.draw(buffer) |
46 driver.draw(buffer2, 20, 00) |
46 driver.draw(buffer2, 20, 00) |