I created options menu in run time based on user inputs.
import tkinter
import tkinter.messagebox
from tkinter import *
top = tkinter.Tk()
number_of_pd = Label(top, text="Number of Products")
list2 = ['1','2','3','4','5']
E_Name=['','','','','','']
a=[]
b=[StringVar(),StringVar(),StringVar(),StringVar(),StringVar()]
def New_number_of_pds(b):
a.append(b)
print(a)
print(b)
def New_number_of_pd(oE_number_of_pd):
y_axis=300
num=1
for num in range(int(oE_number_of_pd)):
y_axis=y_axis+75
E_Name[num]= OptionMenu(top,b[num],*list2,command=New_number_of_pds)
E_Name[num].place(x=y_axis,y=150)
oE_number_of_pd=StringVar()
E_number_of_pd= OptionMenu(top, oE_number_of_pd, *list2,command=New_number_of_pd)
number_of_pd.place(x=150,y=75)
E_number_of_pd.place(x=300,y=75)
top.title('Sri Sai')
top.geometry('2000x1000') # Size 200, 200
top.mainloop()
here options menu is created on the fly.However when i change the options menu the new value is appended not updated since i dont know how to find which option menu is clicked.

