maybe dis is what you want to do. Ijust made some changes to the code.
On 7/17/07, max baseman <[EMAIL PROTECTED]> wrote:
>
> hello all sorry to bother I'm working on my first curses program ive
> been wanting to learn curses for a while now and now that a have a
> lop top with fedora core running in run level 3 ware im trying to
> program all the tools i'll use but curses will be my only gui ALAN
> has been helping me with this program
>
> import curses
> from time import sleep
> scr=curses.initscr()
> population=0
> seconds=0
> try:
> scr.nodelay(1)
> scr.leaveok(0)
> max_y, max_x = scr.getmaxyx()
> while 1:
> sleep(1)
> second=seconds=+1
population=population+2.5
> scr.addstr(0,0,"seconds",seconds)
scr.addch,max_y/2, max_x/2, str(population)[0]
scr.refresh()
> finally:
> curses.endwin()
>
>
> depending on ware i run this i get different results on may mac OSX
> 10.4 i only get a wired second thing in the top left corner that
> looks like this secooes
>
> and when i run this on fedora core 6 i get the seconds word in top
> left but no number and i get a single digit in the midle that changes
> i think the single digit is part of population but not all i cant
> find out what is wrong
>
>
> any help would be great :)
> _______________________________________________
> Tutor maillist - [email protected]
> http://mail.python.org/mailman/listinfo/tutor
>
--
Alejandro Varas G.
T.N.S. en Redes de Computadores.
http://alej0varas.googlepages.com
+56984350861
import curses
from time import sleep
scr=curses.initscr()
population=0
seconds=0
try:
scr.nodelay(1)
scr.leaveok(0)
max_y, max_x = scr.getmaxyx()
while 1:
sleep(1)
seconds += 1
#second should be seconds whit an "s"
population += 2.5
#if you want seconds to be printed on the screen do this
scr.addstr( 0,0,"seconds %d" % seconds )
#and here you do a big mistake, you forget the ()
scr.addstr( max_y/2, max_x/2, str(population) )
scr.refresh()
finally:
curses.endwin()
_______________________________________________
Tutor maillist - [email protected]
http://mail.python.org/mailman/listinfo/tutor