[Tkinter-discuss] grid sticky problem

Olivier Feys olivier.feys at gmail.com
Mon Jul 3 16:24:43 CEST 2006


I'm trying to add frames in a master frame with the grid manager, and it 
seems that the option 'sticky' doesn't work as it should
When I change the size of the master frame, the subframes don't want to 
be resized like expand =1 , fill = 'both' for pack layout manager
Thanks for help



import Tkinter as tk
root = tk.Tk()
frames= []
rw = 0

col=0
fr = tk.Frame(root,borderwidth =1,relief = 'groove');frames+=[fr]
fr.grid(row=rw,column=col,sticky='nswe')
tk.Button(fr,text='button (%d,%d)'%(rw,col)).pack(padx=10,pady=10)
col+=1
fr = tk.Frame(root,borderwidth =1,relief = 'groove');frames+=[fr]
fr.grid(row=rw,column=col,sticky='wens')
tk.Button(fr,text='button (%d,%d)'%(rw,col)).pack(padx=10,pady=10)
rw+=1
col=0
fr = tk.Frame(root,borderwidth =1,relief = 'groove');frames+=[fr]
fr.grid(row=rw,column=col,sticky='wens')
tk.Button(fr,text='button (%d,%d)'%(rw,col)).pack(padx=10,pady=10)
col+=1
fr = tk.Frame(root,borderwidth =1,relief = 'groove');frames+=[fr]
fr.grid(row=rw,column=col,sticky='wens')
tk.Button(fr,text='button (%d,%d)'%(rw,col)).pack(padx=10,pady=10)
col+=1
rw+=1
col=0
fr = tk.Frame(root,borderwidth =1,relief = 'groove');frames+=[fr]
fr.grid(row=rw,column=col,sticky='wens')
tk.Button(fr,text='button (%d,%d)'%(rw,col)).pack(padx=10,pady=10)
col+=1
fr = tk.Frame(root,borderwidth =1,relief = 'groove');frames+=[fr]
fr.grid(row=rw,column=col,sticky='wens')
tk.Button(fr,text='button (%d,%d)'%(rw,col)).pack(padx=10,pady=10)
col+=1

root.mainloop()



Olivier


More information about the Tkinter-discuss mailing list