cannot get columnspan to make button fill the row of a Tkinter frame

984 views Asked by At

I have seen this Python Tkinter - Set Entry grid width 100% and this columnspan in grid options dose't function (which was more useful) but cannot figure out how to get my 'Replot' button to fill the width of the row it is on. No matter what I set the columnspan of the widget to it never changes the width of the button. The button is in a frame with the other widgets and there is nothing else on that row.

enter image description here

Code used for the buttons:

button_quit2 = tk.Button(root, text = "Replot", command = rangesReplot, relief = tk.GROOVE, padx =30, pady =20 )
button_quit2.grid(row = 10, column = 0, columnspan=2)
1

There are 1 answers

1
Delrius Euphoria On BEST ANSWER

To get it to fill the row fully, use sticky='nsew', like:

button_quit2 = tk.Button(frame2, text = "Replot", command = rangesReplot, relief = tk.GROOVE, padx =30, pady =20 )
button_quit2.grid(row = 10, column = 0, columnspan=2,sticky=tk.N+tk.S+tk.E+tk.W) #same as sticky='nsew'

columnspan allocates the button to have up to 2 columns but it does not completely "fill" or stretch the 2 columns.