james carnell wrote:
Trying to use Timer in console based game that gives the user so much time to act. If they do not act then it just passes the turn back to the program to do the next thing. I have Python 2.5 and Windows XP.

http://www.python.org/doc/2.5.2/lib/timer-objects.html
def hello():
    print "hello, world"

t = Timer(30.0, hello)
TypeError:__init__() takes exactly 2 arguments (3 given)

Where is Timer defined?

If you used    from threading import Timer   you should not get that error.

===============================
http://mail.python.org/pipermail/tutor/2004-November/033333.html

Also tried this, but I think it might be outdated. When I type it in it never triggers the function.
================================
so... this kind is where I am:

t=Timer(10.0)

def waitFunction(timerObj):
   newMove = 5 #5 = player will stay in same position on 2d array
   newMove = int(raw_input("Move 1-9 / 0 to
 quit:"))
   timerObj.start()
   while timerObj.isAlive():
      pass
   print newMove

It works, but I am guessing it isn't a very good way to do it. I am curious why I can't get anything to work from the docs. Any help appreciated (and hopefully yahoo won't butcher my indentation).









--
Bob Gailer
Chapel Hill NC
919-636-4239
_______________________________________________
Tutor maillist  -  [email protected]
http://mail.python.org/mailman/listinfo/tutor

Reply via email to