本文整理汇总了Python中Foundation.NSAutoreleasePool.new方法的典型用法代码示例。如果您正苦于以下问题:Python NSAutoreleasePool.new方法的具体用法?Python NSAutoreleasePool.new怎么用?Python NSAutoreleasePool.new使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Foundation.NSAutoreleasePool
的用法示例。
在下文中一共展示了NSAutoreleasePool.new方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: main_thread
# 需要导入模块: from Foundation import NSAutoreleasePool [as 别名]
# 或者: from Foundation.NSAutoreleasePool import new [as 别名]
def main_thread(func, *args, **kwargs):
""" Schedue `func` to be called on the main thread. """
pool = NSAutoreleasePool.new()
obj = MainThreadHelper.new()
obj.func = lambda: func(*args, **kwargs)
selector = objc.selector(obj.onMainThread, signature='[email protected]:')
later = obj.performSelectorOnMainThread_withObject_waitUntilDone_
later(selector, None, False)
示例2: object_and_selector_for_callback
# 需要导入模块: from Foundation import NSAutoreleasePool [as 别名]
# 或者: from Foundation.NSAutoreleasePool import new [as 别名]
def object_and_selector_for_callback(callback, *args, **kwargs):
pool = NSAutoreleasePool.new()
obj = MainThreadHelper.new()
obj.func = lambda: callback(*args, **kwargs)
selector = objc.selector(obj.onMainThread, signature='[email protected]:')
return obj, selector