Python实列:计时器调用

1.#fout.py python中对于计时器的调用....显示...


from dummy_threading import  *

class Fout:
    "This class contain some functions to display..."
    _defualt_string="wait...system is waiting... ..."
    _arg=["start...","...end"]

    def out(self, i=0, string=_defualt_string):
        print string
        print i ,"seconds left..."
        print
        #print "...".join(string)

    def tout(self, sec=1,times=1, string=_defualt_string):
        for i in range(times):
            t=Timer(sec, self.out, [sec*(times-i), string])
            t.start()
        print "...end"

    def sout(self, sec=1, arg=_arg):
        for ss in arg:
            t=Timer(sec, self.out, ["#", ss])
            t.start()
           
    pass

#end of fout.py

试试:

>>>fo=Fout()

>>>fo.tcout(1,10,"En?...Aha...!")

>>>fo.sout(1,["En...?","Aha...!"])


本文来自CSDN博客,转载请标明出处:http://blog.csdn.net/nightiger/archive/2007/05/13/1607279.aspx

你可能感兴趣的:(python,string,timer,class,import)