[Tkinter-discuss] Binding all children
Vasilis Vlachoudis
Vasilis.Vlachoudis at cern.ch
Tue Dec 21 09:58:20 CET 2010
Hi all,
Based on the previous threads I added the nice scrolled.py implementation of a ScrollFrame in my application and now I wanted to bind the Button-4&5 and MouseWheel events to the scrolled frame. My frames are a bit crowded therefore the real area that belongs to the client-scrolledframe is minimal the rest is buttons labels lists etc...
Therefore when I bind the <Button-4>... on the frame, I never get the events when the cursor is above a label or any other widget (which is most of the time).
For the moment after the creation of each frame I am calling a similar like the following function recursively
def bind_childs(w):
if w.bind("<4>"): return
w.bind("<4>", button4)
w.bind("<5>", button5)
for child in w.winfo_children():
child.bind("<4>", button4)
child.bind("<5>", button5)
however I don't find it as a elegant and neat solution.
Is there a way (like bind_all) to bind all children or to get the event if is is not handled by any of the children?
Thanks in advance
Vasilis
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/tkinter-discuss/attachments/20101221/6a16ce07/attachment.html>
More information about the Tkinter-discuss
mailing list