[Tutor] curses
max baseman
dos.fool at gmail.com
Fri Jul 13 04:16:06 CEST 2007
ok after reading a few tutorials i think i know enough to write my
program
here it is
not commented yet though sorry:
import curses
from time import sleep
scr=vurses.initscr()
population=0
seconds=0
try:
scr.nodelay(1)
scr.leaveok(0)
max_y, max_x = scr.getmaxyx()
while scr.getch()== -1:
sleep(1)
seconds=seconds+1
population=population+2.5
scr.addstr(0,0,"seconds:",seconds") # i would like to get this
bottom left but didn't know how
scr.sddch(1,0,population) # here is ware i think I'm having problems
also would like this to be centered
scr.clear()
scr.refresh()
finaly:
curses.endwin()
but i get the error:
traceback (most recent call last):
file "population.py", line 15, in <module>
scr.addch(1,0,population)
TypeError: argument 1 or 3 must be a ch or an int
thank you
More information about the Tutor
mailing list