当前位置: 首页 > news >正文

建筑网78长沙排名优化公司

建筑网78,长沙排名优化公司,中国十大贸易公司排名,wordpress 标签手册本章内容主要是利用python制作一个简单的桌面倒计时程序,包含开始、重置 、设置功能。 目录 一、效果演示 二、程序代码 一、效果演示 二、程序代码 #!/usr/bin/python # -*- coding: UTF-8 -*- """ author: Roc-xb """import tkin…

本章内容主要是利用python制作一个简单的桌面倒计时程序,包含开始、重置 、设置功能。

目录

一、效果演示

二、程序代码


一、效果演示

二、程序代码

#!/usr/bin/python
# -*- coding: UTF-8 -*-
"""
@author: Roc-xb
"""import tkinter as tk
from tkinter import simpledialog
from tkinter import messageboxclass CountdownTimer:def __init__(self, root):self.root = rootself.root.title("倒计时程序")self.root.geometry("450x300")self.countdown_value = 60self.is_counting = Falseself.canvas = tk.Canvas(self.root, width=200, height=200, bg="white")self.canvas.place(x=20, y=20)self.countdown_label = tk.Label(self.root, text="倒计时: 60s", font=("Arial", 20))self.countdown_label.place(x=250, y=20)self.start_button = tk.Button(self.root, text="开始", command=self.start_countdown)self.start_button.place(x=250, y=70)self.reset_button = tk.Button(self.root, text="重置", command=self.reset_countdown)self.reset_button.place(x=250, y=120)self.set_button = tk.Button(self.root, text="设置", command=self.set_countdown)self.set_button.place(x=250, y=170)def start_countdown(self):if self.is_counting:returnself.is_counting = Trueself.countdown()def countdown(self):if self.countdown_value > 0 and self.is_counting is True:self.countdown_value -= 1self.countdown_label.config(text="倒计时: " + str(self.countdown_value) + "s")self.canvas.delete("all")self.canvas.create_rectangle(0, 200 - self.countdown_value * 2, 200, 300, fill="green")self.root.after(1000, self.countdown)elif self.countdown_value > 0 and self.is_counting is False:self.canvas.delete("all")self.is_counting = Falsereturnelse:self.is_counting = Falsemessagebox.showinfo("提示", "倒计时结束")def reset_countdown(self):self.is_counting = Falseself.countdown_value = 60self.countdown_label.config(text="倒计时: " + str(self.countdown_value) + "s")self.canvas.delete("all")def set_countdown(self):if self.is_counting:returnvalue = tk.simpledialog.askinteger("设置倒计时", "请输入倒计时时间(秒):", parent=self.root)if value is not None:self.countdown_value = valueself.countdown_label.config(text="倒计时: " + str(self.countdown_value) + "s")self.canvas.delete("all")if __name__ == '__main__':root = tk.Tk()app = CountdownTimer(root)root.mainloop()

http://www.zhongyajixie.com/news/6347.html

相关文章:

  • 测试网站的访问速度打开百度一下网页版
  • 北京各大网站推广服务公司重庆网页优化seo公司
  • python网站建设代码测试自己适不适合做销售
  • 有没有做淘宝的网站吗学seo推广
  • 做家政网站公司百度快照提交入口
  • 广东建设厅的工程造价网站郑州网络公司
  • 如何策划网站网站设计报价方案
  • 湖南网站建设 干净磐石网络帮人推广注册app的平台
  • 纯静态网站怎么做cdn站点
  • 涿州网站开发中国疫情最新情况
  • 网站备案是空间备案还是域名备案seo是做什么的
  • 网站布局模板seo网站的优化流程
  • 如何建设自己网站首页如何搭建个人网站
  • 博客网站wordpresssem与seo的区别
  • 建设个人网站赚钱的经历制作一个app软件需要多少钱
  • 软慧网站建设东莞seo优化团队
  • 网站上线注意seo分析
  • macos系统做网站免费加精准客源
  • wordpress 侧 悬浮插件seo课程
  • wordpress 网站积分打赏抖音seo供应商
  • 海阳网站制作精准客源app
  • 中国建设网官方网站洞庭湖治理百度荤seo公司
  • 网站建设 代理网站开发合同
  • 网站如何做服务器授权书东莞好的网站国外站建设价格
  • 晋江市住房和城乡建设局网站点击器
  • 微信手机网站设计长沙网站推广合作
  • wap网站 什么意思广州seo关键词优化费用
  • 武威 网站建设如何做好网络宣传工作
  • 惠州市做网站网站检测工具
  • 郑州网站改版网络软文范例