0

I need to filter CSV file by result in ListBox, and result to show up in Text widget. When i use this search function says that Text has no attribute 'insert'.

I need to do it for my homework. I tried everything that i could find in this site and many other sites, but it din't fixed the issue

global search_input
with open(f, 'r', encoding = 'utf-8') as f_in: 
    for line in f_in:
       line = line.strip()
       global row
       row = []
       if search_input in line:
          row.append(line)

TextBox = tkinter.Text(root, height=20, width=30,state='disabled').grid(row=2,column=0,)
TextBox.insert('end',*row)
Zaraki Kenpachi
  • 5,510
  • 2
  • 15
  • 38
Varik
  • 1
  • 1
  • Hi, welcome to StackOverflow! Please make your code as readable as possible, using formatting like `this` and splitting the code into separate lines. This will make it easier for others to understand your question – Ruben Helsloot Jun 16 '19 at 19:18
  • The error you're getting does not tell you that `TextBox` has no method `insert`. Read the error a bit more closely. – Bryan Oakley Jun 16 '19 at 20:41

1 Answers1

-1

He has:

import tkinter as tk

root = tk.Tk()
text_box = tk.Text(root, height=2, width=30)
text_box.pack()
text_box.insert(tk.END, "Text\ntext\n")
tk.mainloop()
Zaraki Kenpachi
  • 5,510
  • 2
  • 15
  • 38