File: 009-box.py

package info (click to toggle)
notcurses 3.0.17%2Bdfsg-3
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 18,780 kB
  • sloc: ansic: 50,375; cpp: 17,808; python: 1,123; sh: 230; makefile: 35
file content (37 lines) | stat: -rw-r--r-- 792 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
from time import sleep
import notcurses as nc

notcurses = nc.Notcurses()
plane = notcurses.stdplane()

BOX_CHARS = (
    nc.NCBOXASCII,
    nc.NCBOXDOUBLE,
    nc.NCBOXHEAVY,
    nc.NCBOXLIGHT,
    nc.NCBOXOUTER,
    nc.NCBOXROUND,
)

COLORS = (
    (None, None),
    (None, nc.rgb(128, 128, 128)),          # default on grey
    (nc.rgb(255, 0, 0), None),              # red on default
    (nc.rgb(0, 255, 0), nc.rgb(0, 0, 255)), # green on blue
)

SY = 7
SX = 10

for y, (fg, bg) in enumerate(COLORS):
    for x, box_chars in enumerate(BOX_CHARS):
        plane.cursor_move_yx(y * SY + 1, x * SX + 1);
        nc.box(
            plane, (y + 1) * SY - 1, (x + 1) * SX - 1,
            box_chars,
            fg=fg, bg=bg,
            # ctlword=0x1f9
        )

notcurses.render()
sleep(5)