#!/usr/bin/env python # -*- coding: utf-8 -*- """ 距离下班时间倒计时 author: gxcuizy date: 2021-04-27 """ 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)') return # 下班时间转为时间戳 work_date = str(work_hour_val) + ':' + str(work_minute_val) + ':' + str(work_secon