Mar-26-2020, 05:21 AM
For starters, to get the value of a Combobox you either use Combobox.get(), or you assign the Combobox a String_Var and use String_Var.get().
Even if you used the correct command to get the Combobox value you don't have any way to get hold of the combo boxes. You could do what you tried to do with the Entry widgets (more about that in a moment), creating a String_Var for each one, putting the String_Var's in a list and using them to get the value, or you could just keep the Combobox objects in a list. What you cannot do is use a local variable and throw it away leaving no way to access the Combobox widget or value.
The Entry widgets don't work either, and that is because you are not binding the entry_values to the Entry widgets. You need to do something like this:
Even if you used the correct command to get the Combobox value you don't have any way to get hold of the combo boxes. You could do what you tried to do with the Entry widgets (more about that in a moment), creating a String_Var for each one, putting the String_Var's in a list and using them to get the value, or you could just keep the Combobox objects in a list. What you cannot do is use a local variable and throw it away leaving no way to access the Combobox widget or value.
The Entry widgets don't work either, and that is because you are not binding the entry_values to the Entry widgets. You need to do something like this:
string_var = tk.StringVar() entry_values.append(string_var) e2 = Entry(root, textvariable=string_var) #<- Need this for it to workYou are missing a lot of bookkeeping that needs to be done to convert this into a viable program. If you want to grow the list of players each time using the Add button you'll have to keep track of the player name Entry widgets and position combo boxes so they can be hidden (pack_forget) when you want to start a new lineup. You may find it easier to create all the widgets you will ever need, and provide a way to identify which widgets contain players. Perhaps checking for a non-empty string in the player name Entry.