I've been working on getting tkinter to open a window for all dictionary items with keys matching a query. Below is a VERY RAW piece of code to show what I'm talking about. show() makes the toplevel windows. Also, not that it has so much going on because I isolate small sections of code to work on in seperate windows then copy and paste them into where they would go, then test and leave other things as comments so if something goes wrong I can temporarily revert back.
def searchfor(self): count=0 list1= query=self.search.get().capitalize() for key in ab.book.keys(): if query[0:2]==key[0:2]: count+=1 print(count) list1.append(key) for items in list1: Interface.result=query.capitalize(),str(ab.book[key]) show() list1= ## for key in ab.book.keys(): if query[0:2]==key[0:2]: query=key Interface.result=query.capitalize(),str(ab.book[query]) show() break else: Interface.result='Query not found.' print(Interface.result) for key in urlinfo.keys(): if query[0:2]==key[0:2]: query=key Interface.url=str(urlinfo[query]) show() break
this causes there to be a duplicate window for one of them. Say I enter Josh and I have 2 Josh's, they both pop up, but one will have an extra window. Ideas?