Frame button binding

Vasilis Vlachoudis <[email protected]>
Newsgroups gmane.comp.python.tkinter
Message-ID <[email protected]>
Hi all,

I want to create a Scrolled Frame, it works nicely with the place command
however when I bind the B2-Motion, and I click the middle mouse button
on the child buttons instead of dragging it does nothing, since they are 
capturing the B2 and not propagate it to the master.

SimplifiedExample:

def dragStart(e):
    print "B2-pressed")

f = Frame(tk)
f.pack(expand=YES, fill=BOTH)
f.bind("<Button-2>", dragStart)

Button(f, text="Button").pack()

I found a not elegant solution of setting the bind to the toplevel like
f.winfo_toplevel().bind("<Button-2>", dragStart)

and in dragStart I am checking
     if not str(e.widget).startswith(str(f)): return

Is there a better way of doing it?

Thanks in advance
Vasilis
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.