You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

test.py 551B

12345678910111213141516171819202122
  1. try:
  2. from Tkinter import *
  3. except ImportError:
  4. from tkinter import *
  5. root = Tk()
  6. root.geometry('300x200')
  7. root.columnconfigure(0, weight=1) # Set weight to row and
  8. root.rowconfigure(0, weight=1) # column where the widget is
  9. container = Frame(root, bg='tan') # bg color to show extent
  10. container.grid(row=0, column=0) # Grid cell with weight
  11. # A couple of widgets to illustrate the principle.
  12. b1 = Button(container, text='First', width=10)
  13. b1.grid()
  14. b2 = Button(container, text='second', width=10)
  15. b2.grid()
  16. root.mainloop()