Support for Listbox.Update
This commit is contained in:
		
							parent
							
								
									3b9850ed39
								
							
						
					
					
						commit
						9a8ece087e
					
				
					 1 changed files with 7 additions and 1 deletions
				
			
		|  | @ -290,7 +290,7 @@ class Listbox(Element): | ||||||
|         :param auto_size_text: True if should shrink field to fit the default text |         :param auto_size_text: True if should shrink field to fit the default text | ||||||
|         :param background_color: Color for Element. Text or RGB Hex        ''' |         :param background_color: Color for Element. Text or RGB Hex        ''' | ||||||
|         self.Values = values |         self.Values = values | ||||||
|         self.TKListBox = None |         self.TKListbox = None | ||||||
|         if select_mode == LISTBOX_SELECT_MODE_BROWSE: |         if select_mode == LISTBOX_SELECT_MODE_BROWSE: | ||||||
|             self.SelectMode = SELECT_MODE_BROWSE |             self.SelectMode = SELECT_MODE_BROWSE | ||||||
|         elif select_mode == LISTBOX_SELECT_MODE_EXTENDED: |         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 |         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) |         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): |     def __del__(self): | ||||||
|         try: |         try: | ||||||
|             self.TKListBox.__del__() |             self.TKListBox.__del__() | ||||||
|  |  | ||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue