Place in a file from drop down list <p>How would you find out the position in a text file of an option selected from a drop down box? I have got a text file of different values stored on new lines. I then load this into an array which forms the values of a drop down box. I would like to know the line position of the value selected by the user. My code so far is included below. </p> <pre><code>from tkinter import * class search(): def __init__ (self, master): self.master = master self.master.title("Search For Quotes Screen") self.master.geometry("2100x1400") self.master.configure(background = 'white') self.master.configure(background = "white") self.Title = Label(self.master, text = "Quote Retrieval", font = ("calibri", 20), bg = "White") self.Title.place(x=650, y = 10) array=[]#initialises array with open('PostCode_File.txt', 'r') as f:# opens name of your file array= [line.strip() for line in f]#puts values of file in array. each line = one part of array f.close() Option = StringVar() Option.set("Please select postcode of quote") self.options = OptionMenu(self.master, Option, *array)#creates drop down menu self.options.config(bg = 'navy', fg='white', font =('calibri', 20)) self.options["menu"].config(bg="Navy", font=('calibri', 13), fg= 'white') self.options.place(x=100, y=100) print( self.options.get()) </code></pre> <p>I have noticed a drop down box doesn't have the function like a text entry box or maybe im using it wrong. Any help would be appreciated. </p>