You need to wrap you alertEnded... method with PyObjcTools.Apphelper.endSheetMethod:
@PyObjcTools.Apphelper.endSheetMethod def alertEnded(self, alert, choice, context): ... (Methods wrapped with endSheetMethod don't need the ObjC name mangling, so you can name it whatever you want.) I have a very weak understanding of why this is needed, but it's something related to sheet callback methods not having a fixed signature. On Wed, Jul 23, 2008 at 11:57 AM, Daniel Ashbrook <[EMAIL PROTECTED]> wrote: > I'm working my way through the excellent book "Cocoa Programming for Mac OS > X", but using PyObjC instead of ObjC. For the most part it's working very > well - a testament to the awesomeness of PyObjC! > > However, I'm occasionally getting a crash from my application that gives no > errors - it just enters into the debugger with no other output. A backtrace > leads through C code to (inevitably) objc_msgSend(), which doesn't help > much. > > In one case I managed to figure out that I needed to add myFunc_ = > objc.accessor(myFunc_) after the definition of myFunc_() (though I have no > clue why), but in the current case that doesn't help. The relevant chunk of > code is below. My debug log shows the "Ending alert sheet" message, but not > the "Alert ended" message. > > > @IBAction > def removeEmployee_(self, sender): > selectedPeople = self._employeeController.selectedObjects() > alert = > NSAlert.alertWithMessageText_defaultButton_alternateButton_otherButton_informativeTextWithFormat_(u'Delete?', > u'Delete', u'Cancel', None, u'Do you really want to delete %d people?' % > len(selectedPeople)) > NSLog(u'Starting alert sheet') > alert.beginSheetModalForWindow_modalDelegate_didEndSelector_contextInfo_(self._tableView.window(), > self, 'alertEnded:code:context:', None) > NSLog(u'Ending alert sheet') > > > def alertEnded_code_context_(self, alert, choice, context): > NSLog(u'Alert ended') > if choice == NSAlertDefaultReturn: > self._employeeController.remove(None) > > > Thanks in advance for any hints, whether general or specific! > > > > Daniel Ashbrook > _______________________________________________ > Pythonmac-SIG maillist - Pythonmac-SIG@python.org > http://mail.python.org/mailman/listinfo/pythonmac-sig > -- Gary http://blog.extracheese.org _______________________________________________ Pythonmac-SIG maillist - Pythonmac-SIG@python.org http://mail.python.org/mailman/listinfo/pythonmac-sig