Normally, an entry widget requests horizontal space equal to the value of the width= option times the "average" character width of the font it displays.
Setting it to 0 makes the entry request exactly enough width to show the string it contains. Making them sticky to the east and west sides of their areas make them grow to the size of the grid cell, if it is larger than their requested size. Making the grid column have nonzero weight means that if the user resizes the window to be wider, extra space will be given to the entry widgets. Perhaps this program does what you're looking for: #----------------------------------------------------------------------- from Tkinter import * t = Tk() l1 = Label(t, text="String 1:") l2 = Label(t, text="String 2:") e1 = Entry(t, width=0); e1.insert("end", "eggs"); e1.focus() e2 = Entry(t, width=0); e2.insert("end", "spam") l1.grid(row=0, column=0, sticky="w") l2.grid(row=1, column=0, sticky="w") e1.grid(row=0, column=1, sticky="ew") e2.grid(row=1, column=1, sticky="ew") t.grid_columnconfigure(1, weight=1, minsize=120) t.wm_title("entry width demo") t.mainloop() #-----------------------------------------------------------------------
pgp6Rij7z8hDA.pgp
Description: PGP signature
-- http://mail.python.org/mailman/listinfo/python-list