王吉元-NWPU

导航

 
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 2013-12-04 22:21  王吉元  阅读(1036)  评论(0编辑  收藏  举报