Timer Help Python 2.5

Does anyone know how to make a Timer function in Python 2.5. Cancel or .cancel() only stops the Timer while in execution, but how do you stop the Timer or threading after execution is finished.  This is what I made for a timer, but it locks up the program.

def main():
    import time
    import threading
    global time
    global threading
    global stoneskinT
   
    stoneskinT = threading.Timer(5.0, stoneskin)
    stoneskinT.start()
    string = raw_input ("... ")
    stoneskinT.cancel()

    while (string == ""):
        stoneskinT = threading.Timer(5.0, stoneskin)
        stoneskinT.start()
        string = raw_input ("... ")
        stoneskinT.cancel()
       
def stoneskin():
    global string
    global stoneskinT   
    print "Potion of stoneskin has worn off."
    string = raw_input ("... ")
main()




Copyright(c) 2017 - PythonBlogs.com
By using this website, you signify your acceptance of Terms and Conditions and Privacy Policy
All rights reserved