notcurses/python/notcurses-pydemo

32 lines
749 B
Plaintext
Raw Normal View History

2020-02-11 01:57:06 +00:00
#!/usr/bin/python3
2020-02-11 01:51:08 +00:00
import locale
from notcurses import notcurses
def demo():
2020-02-20 05:25:08 +00:00
nc = notcurses.Notcurses()
2020-04-08 18:37:10 +00:00
c = notcurses.Cell(nc.stdplane(), ord(' '))
2020-02-20 05:25:08 +00:00
c.setBgRGB(0x80, 0xc0, 0x80)
nc.stdplane().setBaseCell(c)
dims = nc.stdplane().getDimensions()
r = 0x80
g = 0x80
b = 0x80
for y in range(dims[0]):
for x in range(dims[1]):
nc.stdplane().setFgRGB(r, g, b)
nc.stdplane().setBgRGB(b, r, g)
2020-04-08 18:37:10 +00:00
nc.stdplane().putSimpleYX(y, x, ord('X'))
2020-02-20 05:25:08 +00:00
b = b + 2
if b == 256:
b = 0
g = g + 2
if g == 256:
g = 0
r = r + 2
nc.render()
2020-02-11 01:51:08 +00:00
locale.setlocale(locale.LC_ALL, "")
demo()