Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # Tk_Radiobutton2list.py
- from Tkinter import *
- features = ['a', 'b', 'c', 'd']
- master = Tk()
- row = 0
- mappe = {}
- v = {}
- def saver(each):
- print(each, v[each].get())
- mappe[each] = v[each].get()
- print mappe
- MODES = [ ("String", "str"), ("Number","num")]
- for each in features:
- if row >4 :
- continue
- Label(master, text=each).grid(row=row, column=0)
- v[each] = StringVar()
- v[each].set("default")
- col = 1
- for text, mode in MODES:
- Radiobutton(master, text=text, variable=v[each],value = mode, command=lambda feature=each: saver(feature)).grid(row=row,column=col)
- col+=1
- row += 1
- master.mainloop()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement