Python的TkinterButton做为父窗口
#-*-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的父窗口。
相关推荐
YENCSDN 2020-11-17
lsjweiyi 2020-11-17
houmenghu 2020-11-17
Erick 2020-11-17
HeyShHeyou 2020-11-17
以梦为马不负韶华 2020-10-20
lhtzbj 2020-11-17
夜斗不是神 2020-11-17
pythonjw 2020-11-17
dingwun 2020-11-16
lhxxhl 2020-11-16
坚持是一种品质 2020-11-16
染血白衣 2020-11-16
huavhuahua 2020-11-20
meylovezn 2020-11-20
逍遥友 2020-11-20
weiiron 2020-11-16