python - Timer, countdown, time -
i want, on def 'usecaps', repeat 5 seconds. example, after 5 seconds repeats def 'usecaps' after 5 seconds repeats def again , on...
here code:
def mobber(self): global mobber if mobber == 0: mobber = 1 self.enablemobber() #jump enablemobber else: mobber = 0 self.disablemobber() def enablemobber(self): self.mobberbutton.settext("deactivate") self.time.editlinedelaytime.gettext()) self.usecape() def usecape(self): in xrange(player.inventory_page_size*3): braverycape = player.getitemindex(i) if braverycape == 70038: net.senditemusepacket(i) break
i have tried using time.sleep.
i wrote class has function every 5 seconds. used while loop , modular arithmetic.
import time class the_class(): def __init__(self): self.counter=0; def some_function(self,counter): x="i function, doing things!" if self.counter%2 == 0: # if uppercase return x.upper() else: #(here self.counter%2 ==1 , odd lowercase) return x.lower() def a_while_loop(self): while 1==1: #so loop goes on , on because true. time.sleep(5) print self.some_function(self.counter) self.counter+=1 the_class=the_class() the_class.a_while_loop()
Comments
Post a Comment