Alex L.
Alex L.

Reputation: 821

Radiobutton horizontal center alignment Tkinter

I would like to arrange my Radiobuttons horizontally and centered on my Frame such as this example:

After

But I have only been able to do this:

Before

And this is my code :

 self.mit.grid(row=4, column=0)
 self.gpl2.grid(row=4, column=1)
 self.gpl3.grid(row=4, column=2)

Upvotes: 1

Views: 3482

Answers (1)

A. Rodas
A. Rodas

Reputation: 20679

It looks like there is a widget in the 0 column which is wider than the other widgets. Try setting a new frame as the parent of the group of radio buttons:

radiogroup = Frame(master)
# self.mit = Radiobutton(radiogroup, ...)
# ...
self.mit.grid(row=0, column=0)
self.gpl2.grid(row=0, column=1)
self.gpl3.grid(row=0, column=2)
radiogroup.grid(row=4, column=0)

Upvotes: 1

Related Questions