I am trying to get a UI in the below format
import pandas as pd
from Tkinter import *
features = pd.read_csv("C:\\Users\\ggorantla\\Desktop\\Competition\\otto\\data\\train.csv",dtype=object)
features = features.columns
master = Tk()
row = 0
result = []
mappe = {}
def saver(each):
print(each, v.get())
result.append(v.get())
mappe[each] = v.get()
MODES = [ ("String", "str"), ("Number","num")]
for each in features:
if row >4 :
continue
Label(master, text=each).grid(row=row, column=0)
v = StringVar()
v.set("default")
col = 1
for text, mode in MODES:
Radiobutton(master, text=text, variable=v,value = mode, command=saver(each)).grid(row=row,column=col)
col+=1
print(v.get())
row += 1
mainloop()
My problem is when i run this code, I get the UI as expected, but I am not able to store all the variables in the mappe
dictionary or the result
list.
All values are defaulted to "default" value. I am stuck with this one.