def openFile(self): filename = askopenfilename() self.currentFile = DataService.openFile(filename) ws = self.currentFile['Sheet1'] DataService.categorise(ws) self.entryList = DataService.importEntries(self.currentFile, 'Sheet1') entryLength = IntVar() entryLength.set(self.entryList.__len__()) self.nominalList = DataService.getList(ws, 3, 4) nominalLength = IntVar() nominalLength.set(self.nominalList.__len__()) self.deptList = DataService.getList(ws, 1, 2) deptLength = IntVar() deptLength.set(self.deptList.__len__()) nominalText = Label(self, text="Unique Nominal Codes: " + str(nominalLength.get())) nominalText.pack() deptText = Label(self, text="Unique Departments: " + str(deptLength.get())) deptText.pack() entryText = Label(self, text="Unique Postings: " + str(entryLength.get())) entryText.pack() # tkvar = StringVar(root) search = ttk.Combobox(self, state="readonly", textvariable=self.tkvar) menuChoices = self.populateMenu(self.deptList) search['values'] = self.populateMenu(self.deptList) # menuChoices = ['Dept 1', 'Dept 2'] # tkvar.set(menuChoices[0]) print(menuChoices[1]) # popupMenu = OptionMenu(root, tkvar, *menuChoices) Label(root, text="Choose a Dept").place(x=50, y=250) # popupMenu.place(x=50, y=300) search.place(x=50, y=250) sumText = Label(self, text=("Dept Total" + (self.getDeptTotal))) sumText.place(x=200, y=550) def change_dropdown(*args): print(self.tkvar.get()) # link function to change dropdown self.tkvar.trace('w', change_dropdown) print(filename)