Positioning objects tkinter

You need to specify the rows and columns to build the grid, for example:

Label(self.window, text="Left").grid(row=0, column=0, sticky="nws")
Label(self.window, text="Right").grid(row=0, column=1, sticky="nse")
Label(self.window, text="Bottom").grid(row=1, column=0, columnspan=2, sticky="wes")

You also need to tell the geometry manager how to distribute the additional space:

self.window.grid_columnconfigure(0, weight=1)
self.window.grid_columnconfigure(1, weight=1)
self.window.grid_rowconfigure(0, weight=1)

See http://effbot.org/tkinterbook/grid.htm for more information on how the grid geometry manager works.

CLICK HERE to find out more related problems solutions.

Leave a Comment

Your email address will not be published.

Scroll to Top