def donorinfo(self, event):
viewInfo = self.donor_records.focus()
donordata = self.donor_records.item(viewInfo)
row = donordata['values']
self.benefactor_no_entry.set(row[0])
self.first_name_entry.set(row[1]),
self.last_name_entry.set(row[2]),
self.middle_initial_entry.set(row[3]),
self.contact_number_entry.set(row[4]),
self.email_add_entry.set(row[5])
你好,有人能帮助我如何在点击时显示选定的数据库行吗?我不知道为什么当我使用时它不起作用
self.donor_records.bind("<ButtonRelease-1>", self.donorinfo)
self.donor_records.bind("<ButtonRelease-1>", self.donorinfo)
是正确的语法。
如果您想双击:
your_tree.bind("Double-Button-1>", your_func)
selected = your_tree.focus() # your tree witch you want
values = your_tree.item(selected, text="", values=(.....)) # insert in your entries or something else``