-->

tkinter grid not working correctly

2019-01-20 16:23发布

问题:

when I try to make a window using tkinter in python 3.4.2, the windows opens, but the ..grid method doesnt function properly. The label and entry box dont move even though I change the row and column parameters. Please help:

from tkinter import *
root = Tk()

root.geometry("1024x768")
root.resizable(width=FALSE, height=FALSE)


label_title = Label(root, text="Past paper helper")
entry_1 = Entry(root)



label_title.grid(row=0, column=5)
entry_1.grid(row=16, column=1)

root.mainloop()

回答1:

Empty rows and columns have zero size. Column 1000 will give the same effect as column 0, if columns 0-999 are empty. Sames goes for rows.