I've got a Listbox
that isn't updating after inserting, which is in the update_listbox
function. I've put a couple of print
statements in to check list size before and after update, and another print to check values being inserted. All the print
statements show what I would expect if it was working. But it isn't showing it in Listbox
.
class View(Frame):
def __init__(self, master):
Frame.__init__(self, master)
self.list = Listbox(self, selectmode=SINGLE)
self.list.pack(fill=BOTH, expand=YES)
self.list.delete(0, END)
print(self.list.size()) #shows 0 which
self.update_listbox()
print(self.list.size()) #shows the correct number, but listbox doesn't show anything
def update_listbox(self):
temp=products.get_keys()
self.list.delete(0, END)
for i in temp:
print str(products.get_item(i)) #Is showing the correct output.
self.list.insert(END, str(products.get_item(i)))
EDIT
As suggested by Mr steak I changed Listbox(self, selectmode=SINGLE)
to Listbox(master, selectmode=SINGLE)
but that created two listboxes one above and below the Entryframe
(added code below) and the one below correctly displayed the update. Why am I seeing two listboxes now?
class Controller(object):
def __init__(self, master=None):
self._master = master
#filemenubar
self.menu()
#listbox
self.listboxFrame = View(master)
self.listboxFrame.pack(fill=BOTH, expand=YES)
#entry widget
self.EntryFrame = Other(master)
self.EntryFrame.pack(fill = X)