Mercurial > mamba
diff mamba/widgets/base.py @ 283:11cf3a259eaa
Iterate over copies, to avoid some issues with children changing in the loop
author | Neil Muller <drnlmuller@gmail.com> |
---|---|
date | Thu, 15 Sep 2011 21:44:26 +0200 |
parents | 190aa1481908 |
children | a0c60e0c1ef2 |
line wrap: on
line diff
--- a/mamba/widgets/base.py Thu Sep 15 19:59:03 2011 +0200 +++ b/mamba/widgets/base.py Thu Sep 15 21:44:26 2011 +0200 @@ -108,7 +108,7 @@ last resort """ if ev.type in (MOUSEMOTION, MOUSEBUTTONUP, MOUSEBUTTONDOWN): - for child in self.children: + for child in self.children[:]: if child.rect.collidepoint(ev.pos): if ev.type == MOUSEBUTTONDOWN and child.focussable: child.grab_focus() @@ -122,7 +122,7 @@ return True else: # Other events go to all children first - for child in self.children: + for child in self.children[:]: if child.event(ev): return True if super(Container, self).event(ev):