mirror of
https://github.com/dankamongmen/notcurses
synced 2025-03-09 17:19:03 -04:00
pydemo: extract demo from main module
This commit is contained in:
parent
1c05fdb013
commit
e9818fe8e8
@ -105,23 +105,3 @@ class Ncdirect:
|
||||
if __name__ == '__main__':
|
||||
locale.setlocale(locale.LC_ALL, "")
|
||||
nc = Notcurses()
|
||||
c = Cell(nc.stdplane())
|
||||
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)
|
||||
nc.stdplane().putSimpleYX(y, x, b'X')
|
||||
b = b + 2
|
||||
if b == 256:
|
||||
b = 0
|
||||
g = g + 2
|
||||
if g == 256:
|
||||
g = 0
|
||||
r = r + 2
|
||||
nc.render()
|
||||
|
@ -4,7 +4,28 @@ import locale
|
||||
from notcurses import notcurses
|
||||
|
||||
def demo():
|
||||
n = notcurses.Notcurses()
|
||||
nc = notcurses.Notcurses()
|
||||
c = notcurses.Cell(nc.stdplane())
|
||||
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)
|
||||
nc.stdplane().putSimpleYX(y, x, b'X')
|
||||
b = b + 2
|
||||
if b == 256:
|
||||
b = 0
|
||||
g = g + 2
|
||||
if g == 256:
|
||||
g = 0
|
||||
r = r + 2
|
||||
nc.render()
|
||||
|
||||
|
||||
locale.setlocale(locale.LC_ALL, "")
|
||||
demo()
|
||||
|
Loading…
x
Reference in New Issue
Block a user