-
Notifications
You must be signed in to change notification settings - Fork 41
/
Copy pathyou_need_to_rest.py
55 lines (38 loc) · 1.37 KB
/
you_need_to_rest.py
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
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
__author__ = "ipetrash"
import time
# pip install schedule
import schedule
from PyQt5.QtWidgets import *
from PyQt5.QtGui import *
from PyQt5.QtCore import *
# 60 * 1000 * 10 -- 10 minutes
def show_message(text, timeout=60 * 1000 * 10):
print(f"show_message: {text!r}")
msg = QMessageBox()
msg.setWindowFlags(msg.windowFlags() | Qt.WindowStaysOnTopHint)
msg.setWindowTitle("Информация")
msg.setText(f"<p align='center'>{text}<.p>")
msg.setIcon(QMessageBox.Information)
msg.setStandardButtons(QMessageBox.Ok)
font = msg.font()
font.setFamily("Times")
font.setPointSize(50)
msg.setFont(font)
QTimer.singleShot(timeout, msg.close)
msg.exec()
if __name__ == "__main__":
app = QApplication([])
schedule.every().day.at("11:00").do(show_message, "Пора в столовку")
schedule.every().day.at("13:00").do(show_message, "Иди прогуляйся")
schedule.every().day.at("15:00").do(show_message, "Иди прогуляйся")
schedule.every().day.at("17:00").do(show_message, "Иди прогуляйся")
schedule.every().day.at("19:00").do(show_message, "Вали домой")
print("Jobs:")
for job in schedule.jobs:
print(" " + str(job))
print()
while True:
schedule.run_pending()
time.sleep(1)