If Info is blank, then the Entry Field and Button are at the red vertical line. But if Info has text, then they shift to the right. How can I fix the positions of the Entry Field and Button? Thanks.
window = Toplevel()
window.geometry('400x400')
searchL = Label(window, text='Enter ID:')
searchL.grid(row=0, column=0, padx=10, pady=10)
searchE = Entry(window)
searchE.grid(row=0, column=1, padx=10, pady=10)
def searchEmp():
for e in listOfEmployees:
if e.i == searchE.get():
results.set(repr(e))
search = Button(window, text='Search', command=searchEmp)
search.grid(row=1, column=0, columnspan=2)
infoL = Label(window, text='Info:')
infoL.grid(row=2, column=0, padx=10, pady=10)
results = StringVar()
resultsL = Label(window, textvariable=results)
resultsL.grid(row=2, column=1, padx=10, pady=10)
Adding the sticky arg fixed it for this Entry Field.
searchE.grid(row=0, column=1, padx=10, pady=10, **sticky=W**)
For the Search button, columnspan was set to 2, so if I removed columnspan, set the column=2, and added sticky=W, it worked.
Thanks to stovfl for the link.