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

Center ttk.Checkbox in grid column

On Sat, 8 Jun 2019, Terry Reedy wrote:

> 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)

Thanks, Terry.