Support for Listbox.Update

This commit is contained in:
MikeTheWatchGuy 2018-08-23 12:30:35 -04:00
parent 3b9850ed39
commit 9a8ece087e
1 changed files with 7 additions and 1 deletions

View File

@ -290,7 +290,7 @@ class Listbox(Element):
:param auto_size_text: True if should shrink field to fit the default text
:param background_color: Color for Element. Text or RGB Hex '''
self.Values = values
self.TKListBox = None
self.TKListbox = None
if select_mode == LISTBOX_SELECT_MODE_BROWSE:
self.SelectMode = SELECT_MODE_BROWSE
elif select_mode == LISTBOX_SELECT_MODE_EXTENDED:
@ -305,6 +305,12 @@ class Listbox(Element):
fg = text_color if text_color is not None else DEFAULT_INPUT_TEXT_COLOR
super().__init__(ELEM_TYPE_INPUT_LISTBOX, scale=scale, size=size, auto_size_text=auto_size_text, font=font, background_color=bg, text_color=fg, key=key)
def Update(self, values):
self.TKListbox.delete(0, 'end')
for item in values:
self.TKListbox.insert(tk.END, item)
self.TKListbox.selection_set(0, 0)
def __del__(self):
try:
self.TKListBox.__del__()