def search(self): clear = self.clearText.get(1.0, Tkinter.END) rst = Search.search(clear) self.encodedText.delete(1.0, Tkinter.END) content = Search.jsonParser(rst) display = "" if (len(content) == 0): display = "Nothing" else: for tweet in content: key = tweet.keys()[0] display += key + " said: \n" + "\t" + tweet.get(key) + "\n\n" checkReport = False for tweet in content: if(Search.insertMySQL(tweet)): checkReport = True if(checkReport): tkMessageBox.showinfo("Insert to database", "Insert successfully" ) self.encodedText.insert(1.0, display)