how to create the timers in python -
how to create the timers in python -
i'm working on python script want set timers in every 2 seconds allow me update values in setlabel function. need create timers each different values setlabel, because allow me update 1 time @ time.
here example:
#set timer 2 seconds update value in setlabel self.getcontrol(4202).setlabel("1%") #stop timer , set timer 1 time again 2 seconds self.getcontrol(4202).setlabel("8%") #stop timer , set timer 1 time again 2 seconds self.getcontrol(4202).setlabel("16%") and on...
can please tell me how can create timers allow me update values in each @ time?
edit: when seek this:
# loaded info channel in tv_elem.findall('channel'): channel_name = channel.find('display-name').text programme in channel.findall('programme'): title = program.find('title').text start_time = program.get("start") stop_time = program.get("stop") cur.execute("insert programs(channel, title, start_date, stop_date)" + " values(?, ?, ?, ?)", [channel_name, title, start_time, stop_time]) con.commit() con.close time.sleep(2) #stop timer , set timer 1 time again 2 seconds self.getcontrol(4202).setlabel("8%") time.sleep(2) #stop timer , set timer 1 time again 2 seconds self.getcontrol(4202).setlabel("16%") time.sleep(2) #stop timer , set timer 1 time again 2 seconds self.getcontrol(4202).setlabel("24%") it not allow me write info in database. idea?
have considered sleep time module?
import time time.sleep(2) # don't need 1 #set timer 2 seconds update value in setlabel self.getcontrol(4202).setlabel("1%") time.sleep(2) #stop timer , set timer 1 time again 2 seconds self.getcontrol(4202).setlabel("8%") time.sleep(2) #stop timer , set timer 1 time again 2 seconds self.getcontrol(4202).setlabel("16%") python python-2.7 xbmc
Comments
Post a Comment