[Pygui] PyGUI on OSX using 100% cpu time

Erik Oomen erik.oomen at zepcam.com
Wed Jul 6 13:24:51 CEST 2011


> One way to fix this is to add a 1msec delay in GUI/Cocoa/Application.py
>>        time.sleep(0.001)
>>        ns_event = ns_app.nextEventMatchingMask_untilDate_inMode_dequeue_(
>>            NSAnyEventMask, None, ns_mode, True)
>> My question, Is this the appropriate way to fix this?
> 
> It'll do for now, but I'd like to find a better solution.
> I need to look into why I'm using that method in the first
> place instead of just calling runModalForWindow().
> 

This seems to work just as good:
        import Foundation
        ns_distant_future = Foundation.NSDate.distantFuture()
        ns_event = ns_app.nextEventMatchingMask_untilDate_inMode_dequeue_(
            NSAnyEventMask, ns_distant_future, ns_mode, True)




More information about the Pygui mailing list