Page 118 - MDP2020-2
P. 118
| 인천전자마이스터고등학교 ·············································································································
112
self.anim.setStartValue(QRect(1800, 87, 0, 80))
self.anim.setEndValue(QRect(1150, 87, 700, 80))
self.anim.start()
else:
print("hi")
self.anim = QPropertyAnimation(self.label_test, b"geometry")
self.anim.setDuration(200)
self.anim.setStartValue(QRect(1150, 87, 700, 80))
self.anim.setEndValue(QRect(1800, 87, 0, 80))
self.anim.start()
QtCore.QTimer.singleShot(180, lambda: self.label_test.close())
def showtime(self):
# 1970년 1월 1일 0시 0분 0초 부터 현재까지 경과시간 (초단위)
t = time.time()
# 한국 시간 얻기
kor = time.localtime(t)
# LCD 표시
if (kor.tm_hour < 10 and kor.tm_min < 10):
self.label_time.setText(f"0{kor.tm_hour}:0{kor.tm_min}")
elif (kor.tm_hour < 10):
self.label_time.setText(f"0{kor.tm_hour}:{kor.tm_min}")
elif (kor.tm_min < 10):
self.label_time.setText(f"{kor.tm_hour}:0{kor.tm_min}")
else:
self.label_time.setText(f"{kor.tm_hour}:{kor.tm_min}")
if (kor.tm_sec < 10):
self.label_sec.setText(f"0{kor.tm_sec}")
else:
self.label_sec.setText(f"{kor.tm_sec}")
# 타이머 설정 (1초마다, 콜백함수)
timer = Timer(1, self.showtime)
timer.daemon = True
timer.start()
# 팬 동작부
def fan(self,fan_level):
fan_level+=1
if(fan_level>0):
state_fan=1
else:
state_fan=0