Tkinker Python Tutorial

from Tkinter  import *
     
class Radiobar(Frame):
    def __init__(self, parent=None, picks=[], side=LEFT, anchor=W):
        Frame.__init__(self, parent)
        self.var = StringVar()
        for pick in picks:
            rad = Radiobutton(self, text=pick, value=pick, variable=self.var)
            rad.pack(side=side, anchor=anchor, expand=YES)
    def state(self):
        return self.var.get()
     
root = Tk()
radioButtonBar = Radiobar(root, ['a', 'b', 'c'], side=TOP, anchor=NW)
radioButtonBar.pack(side=LEFT, fill=Y)
radioButtonBar.config(relief=RIDGE,  bd=2)
def allstates(): 
   print radioButtonBar.state()
Button(root, text='Peek', command=allstates).pack(side=RIGHT)
root.mainloop()