王吉元-NWPU

导航

 
#-*-coding:utf-8-*-
import Tkinter,time,tkMessageBox,sys,BeBigModule
class MainFrame:
    def __init__(self,father):
        self.frame=Tkinter.Frame(father)
        self.frame.pack()
        
        self.entryWorkWidget=Tkinter.Entry(self.frame)
        self.entryWorkWidget["width"]=35                 #这句话和下句话的先后顺序不会影响程序
        self.entryWorkWidget.pack(side='top')
        
        self.entryRelaxWidget=Tkinter.Entry(self.frame)
        self.entryRelaxWidget.config(width=35)
        self.entryRelaxWidget.pack(side='top')
        
        self.startButton=Tkinter.Button(self.frame,text="OK",command=self.start)
        self.startButton.pack(side='left')
        
        self.quitButton=Tkinter.Button(self.frame,text="Exit",command=self.quit)
        self.quitButton.pack(side='right')
#         self.frame.mainloop()
    def start(self):
        workTime=self.entryWorkWidget.get().strip()
        workTimeNum=int(workTime)   
        self.frame.destroy()     
        beBigFrame=BeBigModule.BeBig(workTimeNum)
        print'success'
    def quit(self):
        pass
# root=Tkinter.Tk()
# root.title("CountDowm")
# 
# mainFrame=MainFrame(root)
# root.mainloop()
abutton=Tkinter.Button()
abutton.pack()
mainFrame=MainFrame(abutton)
abutton.mainloop()

好玩吧,Button成了Frame的父窗口。

posted on 2013-12-05 10:41  王吉元  阅读(890)  评论(0编辑  收藏  举报