I'm very new to both python and Tkinter and would be thankful for some help.
i want to search a text document for a word and print each line that match the searchword in a text widget.
def ladda(): fts = 'thefile.txt' file = open(fts,"r") text = file.readlines() file.close() keyword = re.compile("searchword") for line in text: result = keyword.search (line) if result: text.insert(INSERT, '\n' + line)
The error i get is:
text.insert(INSERT, '\n' + line)
TypeError: an integer is required
I have read about text.insert but dont get it.