From 9cdcd283d0ae341aaac2d3f54c797d6d95f0dd10 Mon Sep 17 00:00:00 2001 From: Alex Samuel Date: Sun, 13 Feb 2022 18:14:08 -0500 Subject: [PATCH] [py] box() example. --- python/examples/009-box.py | 36 ++++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) create mode 100644 python/examples/009-box.py diff --git a/python/examples/009-box.py b/python/examples/009-box.py new file mode 100644 index 000000000..c11b444c2 --- /dev/null +++ b/python/examples/009-box.py @@ -0,0 +1,36 @@ +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, +) + +CHANNELS = ( + 0, + 0x0000000040808080, # default on grey + 0x40ff000000000000, # red on default + 0x4000ff00400000ff, # green on blue +) + +SY = 7 +SX = 10 + +for y, channels in enumerate(CHANNELS): + for x, box_chars in enumerate(BOX_CHARS): + nc.box( + plane, (y + 1) * SY - 1, (x + 1) * SX - 1, y * SY + 1, x * SX + 1, + box_chars, + channels=channels, + # ctlword=0x1f9 + ) + +notcurses.render() +sleep(5)