Responding to record selection

The purpose of this widget is for users to select and open records; therefore, we need a way to do that. It would be nice to be able to trigger this from an event like a double-click or keyboard selection.

The Treeview widget has three special events which we can use to trigger a callback as shown in the following table:

Event string
Triggered when
<<TreeviewSelect>> A row is selected, such as by clicking it with a mouse
<<TreeviewOpen>> A row is opened by a double-click or by selecting it and hitting Enter
<<TreeviewClose>> An open row is closed

 

<<TreeviewOpen>> sounds like the event we want; even though we're not using a hierarchical list, the user is still conceptually opening the record, ...

Get Python GUI Programming with Tkinter now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.