Center ttk.Checkbox in grid column

Terry Reedy tjreedy at udel.edu
Sat Jun 8 18:22:25 EDT 2019


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




More information about the Python-list mailing list