python使用tkinter實(shí)現(xiàn)屏幕中間倒計(jì)時(shí)
更新時(shí)間:2021年03月07日 09:32:17 作者:酷酷的波波
這篇文章主要為大家詳細(xì)介紹了python使用tkinter實(shí)現(xiàn)屏幕中間倒計(jì)時(shí),文中示例代碼介紹的非常詳細(xì),具有一定的參考價(jià)值,感興趣的小伙伴們可以參考一下
本文實(shí)例為大家分享了python實(shí)現(xiàn)屏幕中間倒計(jì)時(shí)的具體代碼,供大家參考,具體內(nèi)容如下
先看下效果圖:
代碼:
import time from tkinter import Tk,Label class TimeShow():#實(shí)現(xiàn)倒計(jì)時(shí) 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='倒計(jì)時(shí){}秒'.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']= '倒計(jì)時(shí){}秒'.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()
以上就是本文的全部內(nèi)容,希望對大家的學(xué)習(xí)有所幫助,也希望大家多多支持腳本之家。
您可能感興趣的文章:
- python實(shí)現(xiàn)倒計(jì)時(shí)的示例
- python實(shí)現(xiàn)倒計(jì)時(shí)小工具
- python實(shí)現(xiàn)的簡單窗口倒計(jì)時(shí)界面實(shí)例
- python 實(shí)現(xiàn)倒計(jì)時(shí)功能(gui界面)
- python實(shí)現(xiàn)簡單倒計(jì)時(shí)功能
- python實(shí)現(xiàn)七段數(shù)碼管和倒計(jì)時(shí)效果
- python實(shí)現(xiàn)windows倒計(jì)時(shí)鎖屏功能
- 親手教你用Python打造一款摸魚倒計(jì)時(shí)界面
- python基于tkinter制作下班倒計(jì)時(shí)工具
- 基于Python實(shí)現(xiàn)倒計(jì)時(shí)工具
相關(guān)文章
Python使用MyQR制作專屬動態(tài)彩色二維碼功能
MyQR是一個(gè)能夠生成自定義二維碼的第三方庫,你可以根據(jù)需要生成普通二維碼、帶圖片的藝術(shù)二維碼,也可以生成動態(tài)二維碼。這篇文章主要介紹了Python使用MyQR制作專屬動態(tài)彩色二維碼,需要的朋友可以參考下2019-06-06手把手教你進(jìn)行Python虛擬環(huán)境配置教程
這篇文章主要介紹了手把手教你進(jìn)行Python虛擬環(huán)境配置,本文給大家介紹的非常詳細(xì),具有一定的參考借鑒價(jià)值,需要的朋友參考下吧,需要的朋友可以參考下2020-02-02Python爬蟲headers處理及網(wǎng)絡(luò)超時(shí)問題解決方案
這篇文章主要介紹了Python爬蟲headers處理及網(wǎng)絡(luò)超時(shí)問題解決方案,文中通過示例代碼介紹的非常詳細(xì),對大家的學(xué)習(xí)或者工作具有一定的參考學(xué)習(xí)價(jià)值,需要的朋友可以參考下2020-06-06用Pelican搭建一個(gè)極簡靜態(tài)博客系統(tǒng)過程解析
這篇文章主要介紹了用Pelican搭建一個(gè)極簡靜態(tài)博客系統(tǒng)過程解析,文中通過示例代碼介紹的非常詳細(xì),對大家的學(xué)習(xí)或者工作具有一定的參考學(xué)習(xí)價(jià)值,需要的朋友可以參考下2019-08-08Python 測試框架unittest和pytest的優(yōu)劣
這篇文章主要介紹了Python 測試框架unittest和pytest的優(yōu)劣,幫助大家更好的進(jìn)行python程序的測試,感興趣的朋友可以了解下2020-09-09