Hi all,

I want to centre a grid layout (with fixed size) inside a frame
e.g. if I do the following

tk = Tk()
Button(tk, text="button1").grid(row=0, column=0, sticky=NSEW)
Button(tk, text="button2").grid(row=0, column=1, sticky=NSEW)
Button(tk, text="button3").grid(row=1, column=0, sticky=NSEW)
Button(tk, text="button4").grid(row=1, column=1, sticky=NSEW)
tk.mainloop()

on python 2.7 I get the 4 buttons anchored on the NW corner of the tk frame
If I resize the window the buttons are stuck there.

I know that I could add an additional frame and use the place manager like
f = Frame(tk)
f.place(relx=0.5, rely=0.5, anchor=CENTER)
and change all buttons to belong to f.

However on python 2.4 I get the 4 buttons perfectly centred in the tk frame
without the additional f-frame.
Is there a special flag that I could do the centering without the need of the 
extra frame.

Thanks in advance
Vasilis

_______________________________________________
Tkinter-discuss mailing list
Tkinter-discuss@python.org
https://mail.python.org/mailman/listinfo/tkinter-discuss

Reply via email to