Quantcast

Questions about treeview

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Questions about treeview

Bill Felton-2
Hi all,
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.

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.

regards,
Bill
_______________________________________________
Tkinter-discuss mailing list
[hidden email]
http://mail.python.org/mailman/listinfo/tkinter-discuss
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Questions about treeview

Michael Lange
Hi Bill,

Thus spoketh Bill Felton <[hidden email]>
unto us on Thu, 12 Apr 2012 08:32:58 -0400:

> Hi all,
> 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)
root.mainloop()


>
> 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?

Regards

Michael


.-.. .. ...- .   .-.. --- -. --.   .- -. -..   .--. .-. --- ... .--. . .-.

No one can guarantee the actions of another.
                -- Spock, "Day of the Dove", stardate unknown
_______________________________________________
Tkinter-discuss mailing list
[hidden email]
http://mail.python.org/mailman/listinfo/tkinter-discuss
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Questions about treeview

Bill Felton-2
Hi Michael,

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)
> root.mainloop()

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
parent window.
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?
>
> Regards
>
> Michael

Thanks, I appreciate the situation and will try to get a bug
report filed with them.  

regards,
Bill

_______________________________________________
Tkinter-discuss mailing list
[hidden email]
http://mail.python.org/mailman/listinfo/tkinter-discuss
Loading...