您当前的位置:首页 > IT编程 > python
| C语言 | Java | VB | VC | python | Android | TensorFlow | C++ | oracle | 学术与代码 | cnn卷积神经网络 | gnn | 图像修复 | Keras | 数据集 | Neo4j | 自然语言处理 | 深度学习 | 医学CAD | 医学影像 | 超参数 | pointnet | pytorch | 异常检测 | Transformers | 情感分类 | 知识图谱 |

自学教程:python使用tkinter实现屏幕中间倒计时

51自学网 2021-10-30 22:53:08
  python
这篇教程python使用tkinter实现屏幕中间倒计时写得很实用,希望能帮到您。

本文实例为大家分享了python实现屏幕中间倒计时的具体代码,供大家参考,具体内容如下

先看下效果图:

代码:

import timefrom tkinter import Tk,Labelclass TimeShow():#实现倒计时    def __init__(self,time_show=5):    self.timeShowWin=Tk()    self.timeShowWin.overrideredirect(True)    self.timeShowWin.attributes('-alpha',1)    self.timeShowWin.attributes('-topmost',True)    self.timeShowWin.attributes('-transparentcolor','black')      self.time_show = time_show    self.time_label=Label(self.timeShowWin,text='倒计时{}秒'.format(self.time_show),font=('楷体',25),fg='red',bg='black')    self.time_label.pack(fill='x',anchor='center')    self.timeShowWin.geometry('+'+str(int(self.timeShowWin.winfo_screenwidth()/2))+'+'+str(125))    self.timeShowWin.after(1,self.show)  def show(self):    while self.time_show >= 0:      print('time_label={}'.format(self.time_label))      self.time_label['text']= '倒计时{}秒'.format(self.time_show)      self.timeShowWin.update()      self.time_show -= 1      time.sleep(1)    self.timeShowWin.destroy()    def start(self):    print('ok')    self.timeShowWin.mainloop()    if __name__ == '__main__':  a=TimeShow(10)  a.start()

以上就是本文的全部内容,希望对大家的学习有所帮助,也希望大家多多支持51zixue.net。


opencv实现回形遍历像素算法
pytorch绘制曲线的方法
万事OK自学网:51自学网_软件自学网_CAD自学网自学excel、自学PS、自学CAD、自学C语言、自学css3实例,是一个通过网络自主学习工作技能的自学平台,网友喜欢的软件自学网站。