Re: [Pgu-devel] Connecting USEREVENT to widgets?
Status: Beta
Brought to you by:
philhassey
From: Gary B. <gb...@cs...> - 2008-03-06 17:03:47
|
I'm continuing down this road, hoping for some input. My last attempt resulted in events being delivered more than once. Now I'm trying this bit right up at the top of Container.event. def event(self,e): used = False if e.type > CLOSE: # allow user events to propagate for w in self.widgets: used = w._event(e) if used: break return used That cures my problem. At my current level of understanding (primitive at best) I think Container.event only propagates most events to objects that have focus. Seems to me some kinds of events are useful regardless. Thanks gb Gary Bishop wrote: > Further investigation shows that several types of events are propagated > in Container.event. > > Adding > for w in self.widgets: # gb > w._event(e) # gb > > just before the final return in Container.event makes my connect work > fine. Is there any downside? > > gb > > > Gary BIshop wrote: >> I've got some webcam monitoring code running in another thread. It >> passes USEREVENTs to my pygame programs. I'm trying now to integrate >> it with pgu. >> >> I figured I could derive a class from gui.Image and set things up so >> that when my webcam refreshes its image, I could post an event to object. >> >> All works but I have to connect the USEREVENT to the container object >> that holds my Webcam widget I'd like to just connect it to the widget >> itself. Don't events get passed down through the container hierarchy? >> Where do they stop? >> >> Thanks for the fine software. >> >> gb >> > |