1 Star 0 Fork 0

wczcw/playground

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
up.py 1.20 KB
一键复制 编辑 原始数据 按行查看 历史
wczcw 提交于 2021-06-03 23:20 . 提肛程序 v1
import tkinter
import tkinter.messagebox
import time
import os
from PIL import Image, ImageGrab, ImageFilter
gif_path = './static/screen.gif'
blur_path = './static/blur.gif'
gap = 1
rest_time = 300
work_time = 2400
def showwarning():
rest_msg = "该休息一下了"
top.withdraw()
tkinter.messagebox.showwarning(message=rest_msg)
def sleep(t):
time.sleep(t)
def auto_close():
sleep(2)
top.destroy()
def safe_check():
if not os.path.exists(gif_path):
b = os.getcwd()
os.mkdir(b+"\\static")
while True:
sleep(work_time)
top = tkinter.Tk()
top.attributes("-topmost", 1)
sleep(gap)
showwarning()
sleep(gap)
w = top.winfo_screenwidth()
h = top.winfo_screenheight()
bbox = (0, 0, w, h)
screen = ImageGrab.grab(bbox)
safe_check()
screen.save(gif_path)
screen = Image.open(gif_path)
screen = screen.convert('RGB').filter(ImageFilter.BLUR)
screen.save(blur_path)
screen.close()
img = tkinter.PhotoImage(file=blur_path)
imgLabel = tkinter.Label(top, image=img)
imgLabel.pack()
top.attributes("-fullscreen", True)
top.wm_deiconify()
top.after(rest_time * 1000, top.destroy)
top.mainloop()
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/watch_out/playground.git
[email protected]:watch_out/playground.git
watch_out
playground
playground
master

搜索帮助