When buttons are stacked vertically they are all in one column.
Assuming you meant: "I would like to have four horizontal buttons in one row.",
with each button in a separate column of that row,
my first recommendation would be to use a frame to contain the buttons.
Here's an example using grid with its row and column options:
import Tkinter as tki # tkinter in Python 3
root = tki.Tk()
frm = tki.Frame(root, bd=16, relief='sunken')
frm.grid()
var = tki.StringVar()
mild = tki.Radiobutton(frm, text='Mild', variable=var)
mild.config(indicatoron=0, bd=4, width=12, value='Mild')
mild.grid(row=0, column=0)
medium = tki.Radiobutton(frm, text='Medium', variable=var)
medium.config(indicatoron=0, bd=4, width=12, value='Medium')
medium.grid(row=0, column=1)
hot = tki.Radiobutton(frm, text='Hot', variable=var)
hot.config(indicatoron=0, bd=4, width=12, value='Hot')
hot.grid(row=0, column=2)
root.mainloop()
or you could use pack, with the side option set to 'left'
.
Here's an example where the buttons are created in a loop, and bound to keys in a dictionary:
import Tkinter as tki
def print_var(*args):
print root.getvar(name=args[0])
# or
print var.get()
root = tki.Tk()
frm = tki.Frame(root, bd=16, relief='sunken')
frm.pack()
var = tki.StringVar()
var.trace('w', print_var)
b_dict = {'Mild':0, 'Medium':0, 'Hot':0}
for key in b_dict:
b_dict[key] = tki.Radiobutton(frm, text=key, bd=4, width=12)
b_dict[key].config(indicatoron=0, variable=var, value=key)
b_dict[key].pack(side='left')
root.mainloop()
Information about the variable classes, and their methods, can be found → here.