我需要在列表框中按结果过滤CSV文件,并将结果显示在文本小部件中。当我使用此搜索功能时,说文本没有属性"插入"。
我需要为我的家庭作业做这件事。我尝试了在这个网站和许多其他网站上可以找到的所有内容,但它没有解决问题
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)
他有:
import tkinter as tk
root = tk.Tk()
text_box = tk.Text(root, height=2, width=30)
text_box.pack()
text_box.insert(tk.END, "Textntextn")
tk.mainloop()