[Tkinter-discuss] Questions about treeview
subscriptions at cagttraining.com
Thu Apr 12 17:22:15 CEST 2012
On Apr 12, 2012, at 10:17 AM, Michael Lange wrote:
>> Is it true that the ttk treeview widget 'swallows' right-mouse clicks?
>> We have a need that could be met with the treeview if we could only
>> figure out how to get pop-up menus to work in that widget. Our tests
>> seem to show that regardless of where in the containment structure one
>> binds <button-2> (widget, frmae, outframe, window, app), if the widget
>> at the "bottom" of the stack is a treeview, the mouse button-2 event
>> will not be caught.
> Maybe you simply confuse Button-2 (the button in the middle, under the
> wheel) and Button-3 ? The following code works here just as expected:
> from Tkinter import *
> import ttk
> root = Tk()
> t = ttk.Treeview(root)
> t.pack(fill='both', expand=1)
> def test(event):
> print 'hi'
> t.bind('<3>', test)
I'm working on both Mac and PC with a test for which is current,
so using the correct button depending.
I know I've got that part right because I get pop-ups everywhere
else I expect/need them, just not in the tree.
I'm going to do some more testing as another review of the code,
and an attempt to mirror your simple test, shows that it's still
not working as I would expect, BUT the problem could lie in
some wrapper code that exists between the treeview and the
I'll post a follow-up if I can't get things to work.
>> Also, are there plans to fix the current problems with horizontal
>> scrolling in treeviews? We have used the work-around of having an
>> empty data column that the user can drag to the right; once the drag
>> moves past the visible bounds of the frame containing the treeview the
>> horizontal scrollbar appears. This seems clumsy and un-intuitive, so
>> we're hoping there's another, better, way to get horizontal scrolling
>> to work.
> I haven't used the treeview much yet, so maybe I am missing something,
> but I do not see any way to do it. Maybe the problem is the way
> ttk reports the widget width to the window manager, just a guess though.
> For some reason you cannot configure the width of a treeview, maybe this
> is related. I am not sure if this is intentional or a bug, but I am afraid
> there is not much we can do here, the problem is apparently on the Tcl/Tk
> side. Maybe you could file a bug report there?
Thanks, I appreciate the situation and will try to get a bug
report filed with them.
More information about the Tkinter-discuss