티스토리 뷰

만든거/프로그램

정각알리미

tl;dr 2024. 7. 23. 14:43

import time
from datetime import datetime
from win10toast import ToastNotifier
import schedule

# 알림을 띄우는 함수
def show_notification():
    now = datetime.now()
    print(f"Checking time: {now.strftime('%H:%M:%S')}")  # 디버깅 메시지
    toaster = ToastNotifier()
    toaster.show_toast("정각 알림",
                       f"현재 시간은 {now.strftime('%H:%M:%S')}입니다.",
                       icon_path=None,
                       duration=60)  # 알림을 10초 동안 표시
    print("Notification shown")  # 디버깅 메시지

# 매시간 00분에 알림을 확인하는 작업 스케줄링
schedule.every().hour.at(":00").do(show_notification)

# 무한 루프를 돌며 스케줄을 실행
while True:
    schedule.run_pending()
    time.sleep(1)

 

이것도 gpt돌렸는데 확실히 라이브러리 날먹이 엄청난 것 같다 파이썬은

공지사항
최근에 올라온 글
최근에 달린 댓글
Total
Today
Yesterday
링크
«   2025/02   »
1
2 3 4 5 6 7 8
9 10 11 12 13 14 15
16 17 18 19 20 21 22
23 24 25 26 27 28
글 보관함