pyobjc

Can't call methods on objects in pyObjC

爷,独闯天下 提交于 2019-12-11 10:21:42
问题 When I call setDelegate_ within my pyObjC code I get an AttributeError: 'tuple' object has no attribute 'setDelegate_' . My Code looks like this: def createMovie(self): attribs = NSMutableDictionary.dictionary() attribs['QTMovieFileNameAttribute'] = '<My Filename>' movie = QTMovie.alloc().initWithAttributes_error_(attribs, objc.nil) movie.setDelegate_(self) Edit I Found out that i can't use any instance methods with the movie object. 回答1: From your comment, it looks like QTMovie.alloc()

Key Events Handling using PyObjC in Mac OS X

此生再无相见时 提交于 2019-12-11 03:29:59
问题 I am stuck in a problem. I am programming screenshot capturing concept using PyObjC. os.system("screencapture -s %s" % check_snapshot) This is what I have used to take the screenshot. Here, check_snapshot is a variable storing file location. screencapture is a built-in function and works perfectly fine. Now, what I am looking for is, in Mac OS X, whenever we press Command + Shift + 3, the whole current window screenshot would be taken, and Command + Shift + 4 will allow you to select a

errorr installing pyobjc on Anaconda python on OSX 10.10.2

故事扮演 提交于 2019-12-10 15:57:07
问题 I have Python 3.3.5 :: Anaconda 2.1.0 (x86_64) on Mac OS X 10.10.2 with XCode 6.2 (6C131e) and pip 6.0.8 I'm trying to install PyObjC following the guide. However when I do pip install -U pyobjc I get the following error: $ pip install -U pyobjc Requirement already up-to-date: pyobjc in ./anaconda/lib/python2.7/site-packages/pyobjc-3.1-py2.7.egg Downloading/unpacking py2app>=0.9 (from pyobjc) Downloading py2app-0.9.tar.gz (1.7MB): 1.7MB downloaded Running setup.py (path:/private/var/folders

NSUserNotificationCenter.defaultUserNotificationCenter() returns None in python

纵饮孤独 提交于 2019-12-10 15:10:44
问题 I am trying to connect to the Mountain Lion notification center via python. I've installed pyobjc and am following the instructions here and here. Also see: Working with Mountain Lion's Notification Center using PyObjC Here's my code: import Foundation, objc import AppKit import sys NSUserNotification = objc.lookUpClass('NSUserNotification') NSUserNotificationCenter = objc.lookUpClass('NSUserNotificationCenter') def notify(title, subtitle, info_text, delay=0, sound=False, userInfo={}): """

No module named objc

六月ゝ 毕业季﹏ 提交于 2019-12-10 13:45:09
问题 I'm trying to use cocoa-python with Xcode but it always calls up the error: Traceback (most recent call last): File "main.py", line 10, in <module> import objc ImportError: No module named objc This seems to be because dispite all my attempts to install or find objc and the other modules used by that file, they are simply not on my computer that I can tell, so does anyone know where I can download the actual files (or could put up their own copies?) as in objc.py, Foundation.py, AppKit.py and

PyObjC + Python 3.0 Questions

只谈情不闲聊 提交于 2019-12-09 15:18:08
问题 By default, a Cocoa-Python application uses the default Python runtime which is version 2.5. How can I configure my Xcode project so that it would use the newer Python 3.0 runtime? I tried replacing the Python.framework included in the project with the newer version but it did not work. And another thing, are PyObjc modules compatible with the new version of Python? 回答1: PyObjC does not yet work with Python 3.0. According to Ronald Oussoren, a (the?) PyObjC developer, Python 3.0 support is

Calling custom Objective-C from a pyobjc application?

 ̄綄美尐妖づ 提交于 2019-12-08 09:23:34
问题 This question is basically the inverse of this other question: Calling Python from Objective-C I have implemented my iPhone application logic in Objective-C (obviously), and am now trying to re-use as much as possible from my XCode project in the server component to save on double-implementation. I have successfully loaded the CoreData data model from Python, however, can't see a way to actually call into the Objective-C logic from Python. Basically I'm trying to access the Objective-C

Python Hello World in PyObjC on iPhone?

社会主义新天地 提交于 2019-12-08 08:55:43
问题 I installed the iphone-python package from Cydia, but the HelloPython app closes immediately when I run it from Springboard. This may be a red herring, but I found the .py file in Terminal and tried to run it with python and got a python error: $ python /private/var/stash/Applications.pwn/HelloPython.app/HelloPython.py Traceback (most recent call last): File "/private/var/stash/Applications.pwn/HelloPython.app/HelloPython.py", line 9, in <module> import objc File "/usr/lib/python2.5/objc/_

Animated progress bar in NSMenuItem

∥☆過路亽.° 提交于 2019-12-08 08:51:28
I want to put an animated progress bar in an NSMenuItem custom view. This is demonstrated in Apple's MenuItemView sample, but it doesn't animate (at least not in 10.5, and the sample is apparently from 10.4). I have tried setting a timer that calls setNeedsDisplay:YES , scheduled as NSEventTrackingRunLoopMode like the docs say. This works, but only for a determinate progress bar if I change the value, and only the first time the menu opens. The second and successive times, the bar redraws twice and then remains frozen. For an indeterminate progress bar, the barber pole stripes never animate.

Animated progress bar in NSMenuItem

心不动则不痛 提交于 2019-12-08 08:10:59
问题 I want to put an animated progress bar in an NSMenuItem custom view. This is demonstrated in Apple's MenuItemView sample, but it doesn't animate (at least not in 10.5, and the sample is apparently from 10.4). I have tried setting a timer that calls setNeedsDisplay:YES , scheduled as NSEventTrackingRunLoopMode like the docs say. This works, but only for a determinate progress bar if I change the value, and only the first time the menu opens. The second and successive times, the bar redraws