Center ttk.Checkbox in grid column
A data input form (screenshot attached) has two ttk.Checkbutton widgets. I've read the manual page for this widget and interpret the justify style as applying to only multiline text descriptors of the checkbutton. Is there a way to center the entire widget within the grid column? TIA, Rich -- https://mail.python.org/mailman/listinfo/python-list
Re: Center ttk.Checkbox in grid column
On Sat, 8 Jun 2019, Rich Shepard wrote: A data input form (screenshot attached) has two ttk.Checkbutton widgets. Looks like the screenshot image was clipped off the message. Is there a widget option for the ttk.Checkbox that horizontally and vertically centers the button and label text in the column width? Rich -- https://mail.python.org/mailman/listinfo/python-list
Re: Center ttk.Checkbox in grid column
On 2019-06-08 18:37, Rich Shepard wrote: On Sat, 8 Jun 2019, Rich Shepard wrote: A data input form (screenshot attached) has two ttk.Checkbutton widgets. Looks like the screenshot image was clipped off the message. Is there a widget option for the ttk.Checkbox that horizontally and vertically centers the button and label text in the column width? Attachments sent to this list are removed automatically. In answer to your question, widgets are centred by default; you have to tell it if you _don't_ want a widget centred horizontally or centred vertically. -- https://mail.python.org/mailman/listinfo/python-list
Re: Center ttk.Checkbox in grid column
On Sat, 8 Jun 2019, MRAB wrote: In answer to your question, widgets are centred by default; you have to tell it if you _don't_ want a widget centred horizontally or centred vertically. That's what I thought but the little box and button label don't look centered but left justified. Thanks, Rich -- https://mail.python.org/mailman/listinfo/python-list
Re: Center ttk.Checkbox in grid column
On 2019-06-08 20:01, Rich Shepard wrote: On Sat, 8 Jun 2019, MRAB wrote: In answer to your question, widgets are centred by default; you have to tell it if you _don't_ want a widget centred horizontally or centred vertically. That's what I thought but the little box and button label don't look centered but left justified. A workaround is to pack the widget in a tk.Frame and then put the frame in the grid cell. -- https://mail.python.org/mailman/listinfo/python-list
Re: Center ttk.Checkbox in grid column
On Sat, 8 Jun 2019, MRAB wrote: A workaround is to pack the widget in a tk.Frame and then put the frame in the grid cell. Okay. For now I'll leave it as-is and wait for feedback from users (if any) when the application is up and running. Thanks again, Rich -- https://mail.python.org/mailman/listinfo/python-list
Re: 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 -- https://mail.python.org/mailman/listinfo/python-list
Re: 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. Rich -- https://mail.python.org/mailman/listinfo/python-list