I would like my Listbox widget to be updated upon clicking of a button. However I encountered a logic error. When I click on the button, nothing happens. No errors at all.
listOfCompanies: [[1, ''], [2, '-'], [3, '@ASK TRAINING PTE. LTD.'], [4, 'AAIS'], [5, 'Ademco'], [6, 'Anacle']
def populatebox():
listBox.insert("end", listOfCompanies)
btn = Button(self, text="Update list", command = lambda: populatebox())
btn.pack()
listOfCompaniesis alistwhich does not exist inside the functionpopulatebox()so when calling it inside that function it returns an errorNameError: name 'listOfCompanies' is not defined. So you are guaranteed to return an error with the code you provided us.listdoesn't exist, full stop. She has declared it incorrectly.