osdir.com


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Center ttk.Checkbox in grid column


On 6/8/2019 12:32 PM, Rich Shepard wrote:

> Is there a way to center the entire widget within the grid column?

This is supposed to be the default.  I managed to get them 
right-justified somehow, but the following works for me on Windows to 
get two centered widgets.

import tkinter as tk
from tkinter import ttk
r = tk.Tk()
c1 = ttk.Checkbutton(r, text='box1')
c2 = ttk.Label(r, text='box2')
r.columnconfigure((0,1), minsize=100, weight=1)
c1.grid(row=0, column=0)
c2.grid(row=0, column=1)


-- 
Terry Jan Reedy