I'm having some issues trying to create a dictionary from 2 lists.
I'm trying to get this as output.
{1: {'name1', 'age1'}, 2: {'name2', 'age2'}, 3: {'name3', 'age3'}}
My current code: (I'm new to coding so this is a mess and very efficient, and yes I do realize I'm running all code below 5 times)
def Update():
for r in range(1,5):
v1list.append(StringVar())
v2list.append(StringVar())
NameEntry = Entry(root, textvariable=v1list[r-1]).grid(row = r, column = 0, sticky=W)
AgeEntry = Entry(root, textvariable=v2list[r-1]).grid(row = r, column = 4, sticky=W)
for var1, var2 in ((a,b) for a in v1list for b in v2list):
UserInput[r] = {var1.get(), var2.get()}
print(UserInput)
The output keeps pushing var1 and var2 forward resulting in this as output:
{1: {''}, 2: {''}, 3: {''}, 4: {''}}
I do actually see all inputs in there they just keep moving forward in the dictionary.