From: Liam C. <cy...@gm...> - 2005-03-20 00:41:57
|
Here you go - def on_keyPress(self, event): #Get the object that was typed into eventSourceWidget = event.target Just like Javascript DOM : ) Regards, Liam Clarke On Sat, 19 Mar 2005 18:25:37 -0600, bra...@om... <bra...@om...> wrote: > > I was glad to discover that generic event handlers such as 'on_closefield' > (without the widget name) appear to be available in PythonCard, but I didn't > see this in any documentation. I just gave it a try because that was how > HyperCard worked. > > HyperCard had a function called "the target" which returned the name of the > widget from which the event was originally generated. Is there any such > equivalent method in PythonCard? > > I'd like to subclass model.Background with a class that could intercept and > process events from all my various backgrounds. This could save me from > having to define an individual event handler for every single widget, at > least in cases where these widgets all have features in common. > > Thanks! > > -- 'There is only one basic human right, and that is to do as you damn well please. And with it comes the only basic human duty, to take the consequences. |