Python 和 Objective-C 的交互接口 PyObjC

码农软件 · 软件分类 · Python开发工具 · 2019-11-13 17:13:14

软件介绍

PyObjC 旨在为 Python 和 Objective-C 两种语言之间提供交互的接口。Python 语言可以通过PyObjC来使用已有的Objective-C的代码,反过来Objective-C也可以利用Python语言的一些功能。

PyObjC最主要的用处是在 Mac OS X 系统下使用纯Python语言来开发 Cocoa GUI 应用程序。

 示例代码:

class MyClass(NSObject):

   def init(self):
       """
       Designated initializer for MyClass
       """
       # ALWAYS call the super's designated initializer.
       # Also, make sure to re-bind "self" just in case it
       # returns something else, or even None!
       self = objc.super(MyClass, self).init()
       if self is None: return None

       self.myVariable = 10

       # Unlike Python's __init__, initializers MUST return self,
       # because they are allowed to return any object!
       return self


class MyOtherClass(MyClass):

   def initWithOtherVariable_(self, otherVariable):
       """
       Designated initializer for MyOtherClass
       """
       self = objc.super(MyOtherClass, self).init()
       if self is None: return None

       self.otherVariable = otherVariable
       return self

myInstance = MyClass.alloc().init()
myOtherInstance = MyOtherClass.alloc().initWithOtherVariable_(20)

本文地址:https://codercto.com/soft/d/18913.html

操作系统

操作系统

[美] William Stallings / 陈向群、陈渝 / 电子工业出版社 / 2012-9 / 75.00元

《国外计算机科学教材系列•操作系统:精髓与设计原理(第7版)》是一本关于操作系统的概念、结构和机制的教材,其目的是尽可能清楚和全面地展示现代操作系统的本质和特点;同时,《国外计算机科学教材系列•操作系统:精髓与设计原理(第7版)》也是讲解操作系统的经典教材,不仅系统地讲述了操作系统的基本概念、原理和方法,而且以当代最流行的操作系统——Windows 7、UNIX和Linux为例,全面清楚地展现了当......一起来看看 《操作系统》 这本书的介绍吧!

RGB转16进制工具
RGB转16进制工具

RGB HEX 互转工具

在线进制转换器
在线进制转换器

各进制数互转换器

Markdown 在线编辑器
Markdown 在线编辑器

Markdown 在线编辑器