Center ttk.Checkbox in grid column

Rich Shepard rshepard at appl-ecosys.com
Sat Jun 8 19:15:38 EDT 2019


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.

Rich



More information about the Python-list mailing list