Python的TkinterButton做为父窗口

时间:2021-07-21 20:03:57
#-*-coding:utf--*-
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"]= #这句话和下句话的先后顺序不会影响程序
self.entryWorkWidget.pack(side='top') self.entryRelaxWidget=Tkinter.Entry(self.frame)
self.entryRelaxWidget.config(width=)
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的父窗口。