Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is PyObjC?

I understand the concept of PyObjC, but can nowhere find any information on what exactly it is or how to get started with it.

Is it like a converter, where youinput python files and get an objective c one? Or is it a library you can import to your objective c files which let's you write python in them?

Or is it something else entirely?

If anyone can give tips on how to approach it, an outline of how it works, or just some instructions on a hello world with it, I would be very grateful.

like image 204
lavelle Avatar asked Oct 17 '10 14:10

lavelle


People also ask

What does PyObjC do?

PyObjC is a bridge between Python and Objective-C. It allows Python scripts to use and extend existing Objective-C class libraries; most importantly the Cocoa libraries by Apple.

What is PyObjC module in Python?

PyObjC is a bridge between Python and Objective-C. It allows full featured Cocoa applications to be written in pure Python. It is also easy to use other frameworks containing Objective-C class libraries from Python and to mix in Objective-C, C and C++ source.

Can we install PyObjC in Windows?

Installation. PyObjC is distributed as a collection of Python packages and can be installed using pip. Manual installation is also supported, but is a lot more work and is therefore more of a power-user feature.


1 Answers

It's a language binding, meaning it allows you to call ObjC code from Python and vice versa. You write wrapper modules in ObjC that can be linked into the Python interpreter (which is written in C) to give it access to ObjC functions (tutorial for this use case). Apparently, the entire Cocoa framework is already wrapped, so you can use that from Python with ease.

Vice versa, it enables you to link the Python interpreter into your ObjC app and use it to execute Python code in your app (tutorial).

like image 67
Fred Foo Avatar answered Sep 18 '22 01:09

Fred Foo