나는 2 초마다 타이머를 설정하여 setLabel 함수의 값을 업데이트 할 수 있도록 Python 스크립트를 작성하고 있습니다. 그들은 한 번에 한 번씩 업데이트 할 수 있기 때문에 setLabel에 대해 서로 다른 값을 사용하여 타이머를 만들어야합니다. 여기 파이썬에서 타이머를 만드는 법
예를 들면 다음과 같습니다#set the timer for 2 seconds to update the value in the setlabel
self.getControl(4202).setLabel("1%")
#Stop the timer and set the timer again for 2 seconds
self.getControl(4202).setLabel("8%")
#Stop the timer and set the timer again for another 2 seconds
self.getControl(4202).setLabel("16%")
등등 ...
당신은 내가 나를 한 번에 각각의 값을 업데이트 할 수 있도록 타이머를 만드는 방법을 말해 주시겠습니까?
편집 :이 때 :
# Get the loaded data
for channel in tv_elem.findall('channel'):
channel_name =
channel.find('display-name').text
for program in channel.findall('programme'):
title = program.find('title').text
start_time = program.get("start")
stop_time = program.get("stop")
cur.execute("INSERT INTO programs(channel,
title, start_date, stop_date)" + " VALUES(?, ?, ?, ?)", [channel_name,
title, start_time, stop_time])
con.commit()
con.close
time.sleep(2)
#Stop the timer and set the timer again
for 2 seconds
self.getControl(4202).setLabel("8%")
time.sleep(2)
#Stop the timer and set the timer again
for another 2 seconds
self.getControl(4202).setLabel("16%")
time.sleep(2)
#Stop the timer and set the timer again
for another 2 seconds
self.getControl(4202).setLabel("24%")
그것은 나 데이터베이스에 데이터를 기록 할 수 없습니다. 어떤 생각?
누구든지 어떻게 알 수 있습니까 ?????????? –
"나를 내버려 두지 않는다"는 것은 무엇을 의미합니까? 오류? 예외? 코드에서 루프에서 con.close()를 호출하는 것이 이상합니다. 루프 앞뒤로 열거 나 닫을 수 있습니다. – pmod