[Tutor] getting back my listbox items
Alan Gauld
alan.gauld at yahoo.co.uk
Sun Jun 24 18:58:59 EDT 2018
On 24/06/18 18:26, Ali M wrote:
Just a quick observation, its too late to read it in detail...
> def update_list(self):
> search_term = self.search_var.get()
> for item in self.listbox.get(0, tk.END):
> if search_term.lower() in item:
> self.listbox.delete(0, tk.END)
> self.listbox.insert(tk.END, item)
This function deletes the entire list if the search
term is included in the item. It does this every time.
So any items inserted at the end in earlier iterations
will be deleted by later finds.
Is that really what you want?
> def entry_delete(self, tag):
> self.entry_search.delete(0, tk.END)
> return None
Why do you have tag as a parameter when you don't use it?
> def entry_insert(self, tag):
> self.entry_search.delete(0, tk.END)
> self.entry_search.insert(0, "Type to Search")
> return None
same here?
G'night. :-)
--
Alan G
Author of the Learn to Program web site
http://www.alan-g.me.uk/
http://www.amazon.com/author/alan_gauld
Follow my photo-blog on Flickr at:
http://www.flickr.com/photos/alangauldphotos
More information about the Tutor
mailing list