In my code, I could only get the output of one query. If I pass the next query in the entry box, the previous output in the textbox remains unchanged and I am not getting the output of my new query.
coding:-
import Tkinter as tk
import re
class SampleApp(tk.Tk):
def __init__(self):
tk.Tk.__init__(self)
self.L1 = tk.Label(self, text="Enter the query")
self.L1.pack()
self.entry = tk.Entry(self)
self.button = tk.Button(self, text="Get", command=self.on_button)
self.button.pack()
self.entry.pack()
self.text = tk.Text(self)
self.text.pack()
def on_button(self):
s1=(self.entry.get())
with open("myxml.txt","rb")as f:
row = f.readlines()
for i, r in enumerate(row):
if s1 in r:
for x in range(i-3,i+4):
s = row[x]
m = re.sub(r'<(\w+)\b[^>]*>([^<]*)</\1>', r'\1-\2', s)
self.text.insert(tk.END, re.sub(r'<[^<>]*>','', m))
app = SampleApp()
app.mainloop()
How can i get the next output after the passing the next query? Please help! Thanks in advance!