Advertisement
here2share

# Tk_grid_framework.py

Sep 26th, 2016
186
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.52 KB | None | 0 0
  1. # Tk_grid_framework.py
  2.  
  3. from Tkinter import *
  4.  
  5. root = Tk()
  6.  
  7. label_1 = Label(root, text="Name")
  8. label_2 = Label(root, text="Password")
  9. entry_1 = Entry(root)
  10. entry_2 = Entry(root)
  11.  
  12. # widgets centered by default, sticky option to change
  13. label_1.grid(row=0, sticky=E)
  14. label_2.grid(row=1, sticky=E)
  15.  
  16. entry_1.grid(row=0, column=1)
  17. entry_2.grid(row=1, column=1)
  18.  
  19. # widgets can take up more than one cell with columnspan and rowspan
  20. c = Checkbutton(root, text="Keep me logged in")
  21. c.grid(columnspan=2)
  22.  
  23. root.mainloop()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement