We can do with pack() : Pack « GUI Tk « Python






We can do with pack()

We can do with pack()
 
from Tkinter import *

class MyApp:
  def __init__(self, parent):
    self.myContainer1 = Frame(parent)
    self.myContainer1.pack()
    
    self.button1 = Button(self.myContainer1)
    self.button1["text"]= "Hello, World!"
    self.button1.pack(side=LEFT)  


    self.button2 = Button(self.myContainer1)
    self.button2.configure(text="Off to join the circus!")  
    self.button2.pack(side=LEFT)   
    

    self.button3 = Button(self.myContainer1)
    self.button3.configure(text="Join me?")  
    self.button3.pack(side=LEFT)    
      
    self.button4 = Button(self.myContainer1, text="Goodbye!") 
    self.button4.pack(side=LEFT)
  
    
root = Tk()
myapp = MyApp(root)
root.mainloop()


           
         
  








Related examples in the same category

1.Pack Button to grid
2.Pack controls
3.Several pack() options for controlling layouts within a frame: side, fill, expand, anchorSeveral pack() options for controlling layouts within a frame: side, fill, expand, anchor