git.net

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

tkinter treeview widget - bind doubleclick to items only ?


On 2020-01-21 06:30, R.Wieser wrote:
> MRAB,
> 
>> self.treeview.bind('<Double-1>', self.on_dclick)
> 
> That is what I used.  Doubleclicking on the heading caused the "on_dclick"
> code to execute, though initially the ".identify()" call in my code returns
> an empty ID (no row present at the location I clicked).
> 
> That changes when the treeview contents are scrolled up, causing a with a
> row to be hidden behind the heading.  At that moment doubleclicking the
> heading my ".identify()" call in the "on_dclick" code returns the ID of the
> row thats hidden behind it. :-(
> 
> Shucks, it seems to be even worse:
> I just scrolled a row containing children (visible by its prefixed the
> to-the-right pointing triangle) behind the heading, and double-clicking the
> heading caused that rows children to unfold and fold.
> 
> I don't think that that should be happening ...   How do I prevent it ?
> 
Huh, I never noticed that!

I think it's an issue with Tk itself. tkinter ("Tk interface") is a 
wrapper around Tcl/Tk, Tk being the GUI extension for the Tcl 
programming language.