[Pythonmac-SIG] How to find correct Carbon module(s)?

Jack Jansen Jack.Jansen at cwi.nl
Wed Feb 25 04:23:30 EST 2004


On 24-feb-04, at 17:12, Dinu Gherman wrote:

> Hi,
>
> I try to use some Carbon packages with vanilla Python 2.3, but
> I'm having trouble to find the right Carbon libs to import...
> Does anybody have a hint as of what to import to make the Carbon
> functions and constants below work in Python 2.3?

I almost have a solution to this problem, but I need a bit of help for 
the last bit.

If I create a module Carbon.Carbon that imports all APIs from the 
Carbon modules We're half way there:
	>>> Carbon.Carbon.Window
	<type '_Win.Window'>
	>>> Carbon.Carbon.NewWindow
	<built-in function NewWindow>
	>>> Carbon.Carbon.NewWindow.__module__
	'_Win'
The '_Win' bits aren't optimal, but that can probably be fixed into 
Carbon.Win somehow.

The bit I don't know how to do is the methods of the various objects. 
They print the right thing when you repr() them:
	>>> Carbon.Carbon.Window.ChangeWindowAttributes
	<method 'ChangeWindowAttributes' of '_Win.Window' objects>
but you really want to refer to it as 
"Carbon.Carbon.ChangeWindowAttributes".

Does anyone have a suggestion for a way to loop over all the objects in 
your namespace, check each object for being a class or type, for each 
matching one that isn't a duplicate find all the methods and put them 
in your namespace too?


Jack Jansen, <Jack.Jansen at cwi.nl>, http://www.cwi.nl/~jack
If I can't dance I don't want to be part of your revolution -- Emma 
Goldman




More information about the Pythonmac-SIG mailing list