Numworks: Text Demos with a Poem and Rolling Screen Credits
The two scripts, which
developed in Numworks:
nwtext1.py: Displaying
a poem one line at a time.
nwtext2d.py: Presenting
the credits in a classic TV show format.
They can be downloaded
here:
https://drive.google.com/file/d/1IEDbLV4-mz9kngj0bBOkvBLrgKYg_5ha/view?usp=sharing
Display
a Poem: newtext.py
Code:
#
nwtext1.py
#
Text Animation Demo 1
#
Numworks
#
Edward Shore, 2/18/2026
#
import modules
from
math import *
from
kandinsky import *
from
time import *
#
Screen: 320 x 220 pixels
#
list of text
t=['Roses
are red','violets are blue','Nuwmorks is great','and so are you!']
#
list of colors: red, violet, amber, ghost white
c=[(255,0,0),(178,0,237),(255,191,0),(245,245,245)]
#
black background
fill_rect(0,0,320,220,(0,0,0))
#
list the text
#
each line is 20 pixels
for
i in range(len(t)):
#
draw the string for each line
#
must include the black background
#
draw_string assumes white background if second color
#
is left off
draw_string(t[i],60,60+20*i,c[i],(0,0,0))
#
time module's sleep
sleep(1)
Notes:
1. Modules used: math,
kandinsky, time. Math was entered by default every time a new script
is started in Numworks. The kandinsky and time modules are specific
to Numworks. The kandinsky module includes the drawing commands
fill_rec and draw_string while the time module has the command sleep.
2. The line
fill_rect(0,0,320,220,(0,0,0)) gives the drawing screen a black
background.
3. The syntax for
kandinsky’s draw_string is: draw_string(string of text, x y, text
color, background color). The colors are optional, with the default
set at black text color and white background. Since we have a black
background for the entire screen, the background color (0,0,0) must
be included.
4. To give readability
I estimate that each line has a height of 20 pixels.
TV
Screen Credits: nwtext2d.py
Code:
#
nwtext2d.py
#
Text Animation Demo 2
#
Numworks
#
Edward Shore, 2/19/2026
#
Goal: give a classic TV style flashing of credits
#
import modules
from
math import *
from
kandinsky import *
from
time import *
#
Screen: 320 x 220 pixels
#
lists of text
#
I'm not going to worry about center justification on this demo
#
unicode for pi is u\03C0
#
top line
t0=['CREDITS','Programmer','Supervisor','Directed
By','Studio','Written By','A Pisces','']
#
bottom line
t1=['','PI
MAN','MS. SQUARE ROOT','PYTHAGOREAN THEOREM','SINE STUDIOS','PI
MAN','Python Production 2026',':) \u03C0']
#
black background in the loop, see comments
#
roll credits
#
each line is 20 pixels
for
i in range(len(t0)):
#
draw a string for each line
#
text is in emerald green
#
background is black, must be included
#
since text is being replaced, we must refresh the screen every time
fill_rect(0,0,320,220,(0,0,0))
draw_string(t0[i],40,60,(80,200,120),(0,0,0))
draw_string(t1[i],40,100,(80,200,120),(0,0,0))
#
delay by 2 seconds
sleep(2)
Notes:
1. Modules used: math,
kandinsky, time. Math was entered by default every time a new script
is started in Numworks. The kandinsky and time modules are specific
to Numworks. The kandinsky module includes the drawing commands
fill_rec and draw_string while the time module has the command sleep.
2. The line
fill_rect(0,0,320,220,(0,0,0)) gives the drawing screen a black
background.
3. The syntax for
kandinsky’s draw_string is: draw_string(string of text, x y, text
color, background color). The colors are optional, with the default
set at black text color and white background. Since we have a black
background for the entire screen, the background color (0,0,0) must
be included.
4. In attempt to
vertically center the credits, I put the top line at y = 60 and the
bottom line at y = 100. In this demo, I did not worry about center
justification, only choosing to left justify all the lines. The
strings for the top line are stored in the list t0 while the strings
for the bottom line are stored in the list t1.
I hope you enjoy these
programs as I did making them,
Eddie
All
original content copyright, © 2011-2026. Edward Shore.
Unauthorized use and/or unauthorized distribution for commercial
purposes without express and written permission from the author is
strictly prohibited. This blog entry may be distributed for
noncommercial purposes, provided that full credit is given to the
author.