[Pygui] Native wrappers?

Greg Ewing greg.ewing at canterbury.ac.nz
Tue Dec 15 23:12:09 CET 2009


Dan Villiom Podlaski Christiansen wrote:

> Did you try to implement the functionality provided by it 
> using a delegate? 

A delegate could probably be used for some of it, but
not all -- e.g. I'm overriding sendEvent: in the application
and doing some processing on all the events that pass through.
Also I'm overriding all the mouse and keyboard event handlers
on most widgets so that PyGUI code can intercept events.

> To be honest, I've never quite been comfortable with multiple
> inheritance :) I haven't used it much and regard it a bit like ‘goto’ — 
> structures which don't suite my way of thinking.

The way I'm using it is just to share the implementations
of a bunch of methods. E.g. all the event handling overrides
are the same for most of the NSView objects that I want to
use them on, but the NS objects already have their own idea
of what class they are, so I can't make them singly-inherit
from a common base class. So I have a PyGUI_NSEventHandler
class containing just those methods, and mix it in with
whatever class needs to use them.

-- 
Greg


More information about the Pygui mailing list