Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to disable multiselection on Treeview in tkinter

I've a Treeview widget, and I need only one row/item to be selected at a time. I've been reading the doc, but I can't find any property or method to do so, nor I've found something useful on SO.

Is it posible? How to?

like image 331
Btc Sources Avatar asked Dec 24 '22 05:12

Btc Sources


1 Answers

The answer is a bit higher up the page:

selectmode

Controls how the built-in class bindings manage the selection. One of “extended”, “browse” or “none”. If set to “extended” (the default), multiple items may be selected. If “browse”, only a single item will be selected at a time. If “none”, the selection will not be changed.

Note that the application code and tag bindings can set the selection however they wish, regardless of the value of this option.

Setting selectmode="browse" should give the behavior you're asking for.

like image 93
fhdrsdg Avatar answered Dec 27 '22 11:12

fhdrsdg