Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

ttk button span multiple columns

I am trying to make a TTK Button that spans multiple columns within a frame. Basically I have two rows of buttons, and I want the last button underneath both rows, to span the width of both rows.

However I am not sure how to accomplish this. This is the code I have on the button:

btnOff = ttk.Button(self, text = "OFF", command = tc.Off).
                    grid(column = 1, row = 10, columnspan = 2, rowspan = 2)

I have tried increasing the column width, but it doesn't seem to help. In fact, even when I try to just set it up normally it is smaller than the other buttons in the rows above it, even though all those buttons have the same grid code as what I posted above.

like image 819
Skitzafreak Avatar asked Jan 04 '23 20:01

Skitzafreak


1 Answers

Example expand last two columns. Row 10 and columns 1 and 2

python 2

import Tkinker as tk

python 3

import tkinter as tk
btnOff = ttk.Button(self, text = "OFF", command = tc.Off).
                grid(column = 1, row = 10, columnspan = 2, sticky = tk.W+tk.E)
like image 135
Efrain Vergara Avatar answered Jan 16 '23 03:01

Efrain Vergara