私は設計しているアプリケーションにNSOpenPanelを使いたいと思っています。ここで私がこれまで持っているものです。PyObjCセレクタでvoidポインタをどのように表現するのですか?
@objc.IBAction
def ShowOpenPanel_(self, sender):
self.panel = NSOpenPanel.openPanel()
self.panel.setCanChooseFiles_(False)
self.panel.setCanChooseDirectories_(True)
NSLog(u'Starting OpenPanel')
self.panel.beginForDirectory_file_types_modelessDelegate_didEndSelector_contextInfo_(
self.defaults.objectForKey_(u'projpath'),
objc.nil,
objc.nil,
self,
objc.selector(self.OpenPanelDidEnd_returnCode_contextInfo_,
signature='v:@ii'),
objc.nil)
NSLog(u'OpenPanel was started.')
def OpenPanelDidEnd_returnCode_contextInfo_(self, panel, returnCode, context):
NSLog('Panel ended.')
if (returnCode == NSOKButton):
NSLog(u'User selected OK')
path = self.panel.filenames()[0]
self.defaults.setObject_forKey_(path, u'projpath')
del self.panel
私は心配ですメインの2行は、次のとおりです。
objc.selector(self.OpenPanelDidEnd_returnCode_contextInfo_,
signature='v:@ii'),
objc.nil) #this is the argument that gets passed as the void pointer
第三引数が空ポインタであると考えられます。私はそのデータを使用するつもりはないので、空白のままにしておきたいと思います。私は'v:@iv'
の署名を試みて、objc.NULL
とpythonのNone
を試してみました。これを処理する最善の方法は何ですか?
ありがとうございます、今週末に試してみます! –