上班摸鱼是一个打工人的常态,与其不断地盯着时间看还有多久下班,还不如用一个倒计时器帮你计时,让你知道还有多久下班,好准时跑路。
具体实现代码(python)下面已经给出,这里博主也生成了.exe可执行文件,如有需要,可以直接私聊博主。如下图
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from tkinter import *
import time
import os
def refresh_current_time():
"""刷新当前时间"""
clock_time = time.strftime('%Y-%m-%d %H:%M:%S')
curr_time.config(text=clock_time)
curr_time.after(1000, refresh_current_time)
def refresh_down_time():
"""刷新倒计时时间"""
# 当前时间戳
now_time = int(time.time())
# 下班时间时分秒数据过滤
work_hour_val = int(work_hour.get())
if work_hour_val > 23:
down_label.config(text='小时的区间为(00-23)')
return
work_minute_val = int(work_minute.get())
if work_minute_val > 59:
down_label.config(text='分钟的区间为(00-59)')
return
work_second_val = int(work_second.get())
if work_second_val > 59:
down_label.config(text='秒数的区间为(00-59)'</