Reputation: 11
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])
Hello, can someone help me on how to display the selected database row when clicking it? I don't know why it doesn't work when I use
self.donor_records.bind("<ButtonRelease-1>", self.donorinfo)
Upvotes: 1
Views: 613
Reputation: 332
if you want double click:
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``
Upvotes: 0
Reputation:
self.donor_records.bind("<ButtonRelease-1>", self.donorinfo)
is the correct syntax.
Upvotes: 1