ValueError: <tkinter.OptionMenu object .!optionmenu> is not in list ValueError: <tkinter.OptionMenu object .!optionmenu> is not in list tkinter tkinter

ValueError: <tkinter.OptionMenu object .!optionmenu> is not in list


The problem was that self.drop2 is an object of OptionMenu, not the value of it. To get the value returned by it, use the get() method on its variable defined (self.clicked2.get())

So it should be:

print(safeDis[chem.index(self.clicked2.get())])

Hope it solved the error, do let me know if any more doubts

Cheers