from tkinter import * def selection(): selection = "You selected the option " + str(radio.get()) label.config(text = selection) top = Tk() top.title("Aimtocode") top.geometry("300x200") radio = IntVar() lbl = Label(text = "Select Your Favourite language:") lbl.pack() R1 = Radiobutton(top, text="C", variable=radio, value=1, command=selection) R1.pack( anchor = W ) R2 = Radiobutton(top, text="C++", variable=radio, value=2, command=selection) R2.pack( anchor = W ) R3 = Radiobutton(top, text="Java", variable=radio, value=3, command=selection) R3.pack( anchor = W) R4 = Radiobutton(top, text="Python", variable=radio, value=4, command=selection) R4.pack( anchor = W) R5 = Radiobutton(top, text="JavaScript", variable=radio, value=5, command=selection) R5.pack( anchor = W) R6 = Radiobutton(top, text="C Sharp", variable=radio, value=6, command=selection) R6.pack( anchor = W) label = Label(top) label.pack() top.mainloop()