Advertisement
here2share

# Tk_frame_size.py

Oct 19th, 2016
195
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.59 KB | None | 0 0
  1. # Tk_frame_size.py
  2.  
  3. from Tkinter import *
  4.  
  5. def small(event):
  6.     fra.configure(width=300)
  7. def middle(event):
  8.     fra.configure(width=600)
  9. def big(event):
  10.     fra.configure(width=900)
  11.  
  12. root = Tk()
  13.  
  14. fra = Frame(root,width=300,height=100,bg="green")
  15. but1 = Button(root,text="300x100")
  16. but2 = Button(root,text="600x100")
  17. but3 = Button(root,text="900x100")
  18.  
  19. but1.bind("<Button-1>",small)
  20. but2.bind("<Button-1>",middle)
  21. but3.bind("<Button-1>",big)
  22.  
  23. fra.grid(row=0,column=0,columnspan=3)
  24. but1.grid(row=1,column=0)
  25. but2.grid(row=1,column=1)
  26. but3.grid(row=1,column=2)
  27.  
  28. root.mainloop()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement