Skip navigation.
 
mlRe: Cocoa Python broken in Leopard??
FROM : Uliano Guerrini
DATE : Wed Nov 07 18:04:07 2007

Il giorno 07/nov/07, alle ore 17:48, Bill Bumgarner ha scritto:
>
> Import Quartz *after* the application's main event loop has been 
> started, either in applicationDidFinishLaunching_() as I 
> demonstrated in my first message:
>

>> class FoobarAppDelegate(NSObject):
>>    def applicationDidFinishLaunching_(self, sender):
>>        import Quartz


this is useless as the scope of that import is limited to that 
function in that file

>>

>
> Or import it as the first line of the drawRect_() method of your view.



I found a better (much efficient, I hope) workaround:

Quartz = None

class MyView(NSView):
    def awakeFromNib(self):
        global Quartz
        Quartz = __import__('Quartz')

    def drawRect_(self, rect):
        context = NSGraphicsContext.currentContext().graphicsPort()
        Quartz.whatever()

here the import happens to be called only once per class and Quartz is 
global to the whole file. Still it is not elegant but I can live with it

cheers,

uliano

Related mailsAuthorDate
mlCocoa Python broken in Leopard?? Uliano Guerrini Nov 7, 08:49
mlRe: Cocoa Python broken in Leopard?? Bill Bumgarner Nov 7, 08:58
mlRe: Cocoa Python broken in Leopard?? Uliano Guerrini Nov 7, 09:46
mlRe: Cocoa Python broken in Leopard?? Bill Bumgarner Nov 7, 09:57
mlRe: Cocoa Python broken in Leopard?? Uliano Guerrini Nov 7, 10:41
mlRe: Cocoa Python broken in Leopard?? Bill Bumgarner Nov 7, 17:48
mlRe: Cocoa Python broken in Leopard?? Uliano Guerrini Nov 7, 18:04
mlRe: Cocoa Python broken in Leopard?? Bill Bumgarner Nov 7, 18:46
mlRe: Cocoa Python broken in Leopard?? Luc Heinrich Nov 8, 09:32
mlRe: Cocoa Python broken in Leopard?? Uliano Guerrini Nov 8, 13:00
mlRe: Cocoa Python broken in Leopard?? Luc Heinrich Nov 8, 14:10
mlRe: Cocoa Python broken in Leopard?? Uliano Guerrini Nov 8, 14:41