Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # Tk_radio_btn_demo.py
- from Tkinter import *
- cb_strings = ['item 1', 'item 2', 'item 3', 'item 4']
- def sel():
- print "You selected the option " + str(var.get())
- root = Tk()
- var = StringVar()
- var.set(cb_strings[0])
- for item in cb_strings:
- button = Radiobutton(root, text=item, variable=var, value=item, command=sel)
- button.pack(anchor=W)
- root.mainloop()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement