王吉元-NWPU

导航

< 2025年4月 >
30 31 1 2 3 4 5
6 7 8 9 10 11 12
13 14 15 16 17 18 19
20 21 22 23 24 25 26
27 28 29 30 1 2 3
4 5 6 7 8 9 10
统计
 
复制代码
import Tkinter,time
class MyFrame(Tkinter.Frame):
    def __init__(self):
        Tkinter.Frame.__init__(self)
        self.grid()
        self.canvas = Tkinter.Canvas(self, bg='black',width=self.winfo_screenwidth(),height=self.winfo_screenheight())
        self.canvas.pack()
        self.top = self.winfo_toplevel()
        
#       self.top.update_idletasks()
        self.top.overrideredirect(True)
        
        self.exitButton=Tkinter.Button(self,text='Exit',command=self.doExit)
        self.exitButton.pack()
        self.Label1=Tkinter.Label(self,text='Hello')
        self.Label1.pack()
        self.exitButton.config()
#       self.pack(fill='both')
        self.trickit(5)
        app.mainloop()
    def doExit(self):
        
        pather=self.winfo_parent()
        pather.quit()
        self.quit()
    def trickit(self,num):
        for j in range(num,0,-1):
            self.Label1["text"]=j
            self.update()
            time.sleep(1)
        self.doExit()
复制代码

还没完工,倒计时没显示出来

 

改进版的:

复制代码
import Tkinter,sys,time
class BeBig():
    root=Tkinter.Tk()
    Label1=Tkinter.Label(root,text=time.strftime('%Y-%m-%d %H:%M:%S',time.localtime(time.time())))
    def beBig(self):
        
        self.root.minsize(self.root.winfo_screenwidth(), self.root.winfo_screenheight())
        #self.root.geometry('300x200-100-100')
        self.root.config(bg='black')
        self.Label1.pack()
        topTitle=self.root.winfo_toplevel()
        topTitle.overrideredirect(True)
        self.trickit(5)
        self.root.mainloop()
    def trickit(self,num):
        for j in range(num,0,-1):
            self.Label1["text"]=j
            self.root.update()
            time.sleep(1)
            
        self.root.destroy()
beBig=BeBig()
beBig.beBig()
复制代码

 

posted on   王吉元  阅读(1041)  评论(0)    收藏  举报
编辑推荐:
· C#高性能开发之类型系统:从 C# 7.0 到 C# 14 的类型系统演进全景
· 从零实现富文本编辑器#3-基于Delta的线性数据结构模型
· 记一次 .NET某旅行社酒店管理系统 卡死分析
· 长文讲解 MCP 和案例实战
· Hangfire Redis 实现秒级定时任务,使用 CQRS 实现动态执行代码
阅读排行:
· C#高性能开发之类型系统:从 C# 7.0 到 C# 14 的类型系统演进全景
· 管理100个小程序-很难吗
· 在SqlSugar的开发框架中增加对低代码EAV模型(实体-属性-值)的WebAPI实现支持
· .NET Core中的配置Configuration实战
· 记一次 .NET某工控任务调度系统 卡死分析
 
点击右上角即可分享
微信分享提示