其中的treeview绑定的双击事件无效,不显示任何东西
```python
from tkinter import *
from tkinter import ttk
from tkinter.ttk import Treeview
from test2.db import db
class search(Frame):
def __init__(self,master):
super().__init__(master)
self.table_view=Frame()
self.table_view.pack()
self.create_page()
def create_page(self):
columns=("name","chinese","math","english")
columns_values= ("姓名", "语文", "数学", "英语")
self.tree_view =ttk.Treeview(self,show='headings',columns=columns)
self.tree_view.column("name",width=80,anchor='center')
self.tree_view.column("chinese", width=80, anchor='center')
self.tree_view.column("math", width=80, anchor='center')
self.tree_view.column("english", width=80, anchor='center')
self.tree_view.heading('name',text="姓名")
self.tree_view.heading('chinese',text="语文")
self.tree_view.heading('math', text="数学")
self.tree_view.heading('english', text="英语")
self.tree_view.pack(fill=BOTH,expand=True)
self.tree_view.bind("Double-Button-1>",self.dssdd)
self.show_data_frame()
Button(self,text="刷新数据",command=self.show_data_frame).pack(anchor=E,pady=5)
def dssdd(self):
print("dasdsadasd")
def show_data_frame(self):
for _ in map(self.tree_view.delete,self.tree_view.get_children('')):
pass
students=db.all()
index=0
for stu in students:
print(stu)
self.tree_view.insert("",index+1,values=(
stu['name'],stu['math'],stu['chinese'],stu['english']
))