Tkinter Buttons can be configured through the different available attributes and properties in Tkinter. We can add a sticky property to make it sticky relative to the window in which it is residing. The sticky property allows the widget to set the relative position in the window. To make a button sticky, we have to choose the direction or position such as N, E, S, W, NE, NW, SE, SW, and zero.
Example
#Import the tkinter library from tkinter import * from tkinter import ttk #Create an instance of tkiner frame win= Tk() #Define the geometry of the function win.geometry("750x250") #Create a button to close the window btn1 = ttk.Button(win, text ="I am in Column 3") btn1.grid(column=3) btn2=ttk.Button(win, text="I am stuck to South West") btn2.grid(sticky=SW) btn3= ttk.Button(win, text="I am stuck to North west") btn3.grid(sticky=N) win.mainloop()
Output
The above code will display a window that contains some sticky buttons.