from Tkinter import *
class PackDemo( Frame ):
def __init__( self ):
Frame.__init__( self )
self.master.title( "Packing Demo" )
self.master.geometry( "400x150" )
self.pack( expand = YES, fill = BOTH )
self.button1 = Button( self, text = "Add Button",
command = self.addButton )
self.button1.pack( side = TOP )
def addButton( self ):
Button( self, text = "New Button" ).pack( pady = 5 )
def main():
PackDemo().mainloop()
if __name__ == "__main__":
main()
|