Representatives of Python AppKit and ObjectiveC

AppKit allows Python programs on Mac to use ObjectiveC classes. I am not very familiar with ObjectiveC, but I want to access the NSSound class using AppKit to create an audio player.

My player has to do some things like loading the next item from the playlist when the current sound ends. There is a method called sound: didFinishPlaying: that is being called at that moment, I suppose. According to the documentation, a delegate must be installed that receives this method call.

Can someone help me translate this into Python / AppKit? How can I implement a delegate in Python and let it receive a didFinishPlaying notification?

+3
source share
1 answer

The first step to successfully developing a Cocoa / AppKit application based on PyObjC is to learn Objective-C , and then get to know Cocoa .

The second step is to drop Python and just use Objective-C for your application.

PyObjC (and MacRuby) are awesome technologies, but success in both cases requires an understanding of the patterns and APIs of system frameworks. This , in turn, requires a working knowledge of Objective-C, enough to create simple applications.

, Python - , Twisted, Python . / Objective-C Cocoa API.

+4

Source: https://habr.com/ru/post/1735417/


All Articles