[Tutor] curses

max baseman dos.fool at gmail.com
Sat Jul 14 16:08:28 CEST 2007


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 :) 
  


More information about the Tutor mailing list