pyobjc

How to install pyobjc on SnowLeopard's non-default python installation

Hi everybody. I'm having problems installing pyobjc on SnowLeopard. It came with python 2.6 but I need 2.5 so I have installed 2.5 successfully. After that I have installed xcode. After that I have installed pyobjc with "easy_install-2.5 pyobjc" But when I start my python 2.5 and from cmd line try to import Foundation, it says "no modu...

applicationDidFinishLaunching not being called on py2app application

applicationDidFinishLaunching on my app delegate is being called when I run my Python-Cocoa app from the Terminal (i.e. python myapp.py). However, if I then use py2app to create an .app bundle, applicationDidFinishLaunching does not get called when I open the .app bundle. ...

Apply a Quartz filter while saving PDF under Mac OS X 10.6.3

Using Mac OS X API, I'm trying to save a PDF file with a Quartz filter applied, just like it is possible from the "Save As" dialog in the Preview application. So far I've written the following code (using Python and pyObjC, but it isn't important for me): -- filter-pdf.py: begin from Foundation import * from Quartz import * import objc...

pyobj access to iTunes application

Let's say I managed to get the dictionary opened for iTunes in the Applescript editor: How would I access the "search" commands using Python with pyobjc? I know I get can hold of the iTunes application using: iTunes = SBApplication.applicationWithBundleIdentifier_("com.apple.iTunes") but after I do a dir on it, I don't see the sear...

Reinterpret a CGImageRef using PyObjC in Python

Hi, I'm doing something that's a little complicated to sum up in the title, so please bear with me. I'm writing a Python module that provides an interface to my C++ library, which provides some specialized image manipulation functionality. It would be most convenient to be able to access image buffers as CGImageRefs from Python, so they...

python and objc bridge in an existing application

hi, I resently started programming in objc and I was wandering how can I use python code in an existing objc application. I found some threads in this site and some others but they didn't help me at all. What I want to do is to take the SpotlightAPI found in apple's developer website and use the results to process them with python code. ...

How to change the OSX menubar in wxPython without any opened window?

I am writing a wxPython application that remains open after closing all of its windows - so you can still drag & drop new files onto the OSX dock icon (I do this with myApp.SetExitOnFrameDelete(False)). Unfortunately if I close all the windows, the OSX menubar will only contain a "Help" menu. I would like to add at least a File/Open men...

py2app, pyObjc & macports compilation errors

Hi, I'm currently writing a small python app that embeds cherrypy and django using py2app. It worked well until I tried to include pyobjc in my project, since my app needed a small GUI (which consists of a small icon in the top menu bar + a drop down menu). I can run my python script without any problem (I'm using python 2.6 with macpo...

ImportError: No module named Foundation

Hey all, I'm pretty new to python, so bear with me. I want to write a simple script using some components of PyObjC. I'm running on Mac OS 10.5, so from what I've read, it's included. However, opening up a simple python prompt and typing import Foundation gives me the error ImportError: No module named Foundation. For reference, my sy...

Growl Python binding with Click feedback?

Hi, I'm trying to use Growl Python binding to write a small application. One of the feature that's currently missing is the click notification sent to Python. I know in Objective-C, when a user click the notification, it will send the trigger to the running application. I'd like to do the similar thing in Python binding. When a user c...

How to create a Cocoa library and use it in python.

Hello. I've been making a game and the python library I was used is terrible (Pyglet). I want to try using Cocoa for the OSX version. I'll be able to figure out using the objects from classes like NSWindow and NSOpenGLView and then put these objects in my own class for the game loop. I have no idea how I can use PyObjC to load a dynami...

Any good client-server data sync frameworks available for iPhone?

I'm just getting into the client-server data sync stage of my iPhone app project, and have managed to get my CoreData data model loading on both the iPhone client and my TurboGears server (which is good). I'm now beginning to tackle the problem of sync'ing data between the server and multiple clients, and while I could roll my own, this...

Using python function callbacks with PyObjC?

I'm trying to use an Objective-C class made in Python to do this but Objective-C can't call the method which calls the python function. Here's the framework code which the Objective-C code: // // scalelib.h // Scalelib Cocoa Framework // // Created by Matthew Mitchell on 04/07/2010. // Copyright 2010 __MyCompanyName__. All rights r...

Calling custom Objective-C from a pyobjc application?

This question is basically the inverse of this other question: http://stackoverflow.com/questions/1308079/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-implementatio...

wxPython on Mac OS X: creating a wx.Frame without stealing focus

I managed to get it working on Win32 (inheriting from wx.MiniFrame does the trick), on wxGTK (wx.PopupWindow) but whatever I try, when I create a frame on wxMac, my main window loses focus and the new frame gets it. wxMac does not seem to have a way to interact with the native platform (something like GetHandle() on Win32 and GetGTKWidg...

Getting python exceptions printed the normal way with PyObjC

I'm getting errors like this: 2010-07-13 20:43:15.131 Python[1527:60f] main: Caught OC_PythonException: : LoginMenuSet instance has no attribute 'play_sound' That's with this code: @try { [section loop]; //Loop through section } @catch (NSException *exception) { NSLog(@"Caught %@: %@", [exception name], [exception ...

How to build pyobjc from src

I am trying to build pyobjc from src, so I checked out http://svn.red-bean.com/pyobjc/trunk but I have no clue after that what I do to build it, I do not see any make or setup files? Edit 1: I tried setup.py in trunk/pyobjc/pyobjc folder but it tries to download all the required modules which seem to be already in trunk/pyobjc e.g. it ...

Error in `import objc` : Symbol not found: _PyType_Modified

My system is Mac OS X 10.5.8 and I have installed python from http://www.python.org/ftp/python/2.5.4/python-2.5.4-macosx.dmg because I do not want to use System python (python which already comes installed with Mac OS X) and have totally removed system python. Now when I try to install pyobjc it installs, but on import gives error Pyth...

Compiling a PyObjC application for 10.5 (Leopard) into xcode 10.6 (Snow Leopard)

I'm trying to deploy on 10.5 a PyObjC (or Cocoa-Python) application developed on Xcode 3.2.X (Snow Leopard) which runs perfectly fine on 10.6 systems. The application doesn't launch on 10.5;it crashes at launch giving this error message (found on Crash Report): Dyld Error Message: Library not loaded: /System/Library/Frameworks/...

finding the app window currently in focus on Mac OSX

I am writing a desktop usage statistics app. It runs a background daemon which wakes up at regular intervals, finds the name of the application window currently in focus and logs that data in database. I manage to do this on Linux desktop with help of xprop utility (you can find it here). How can I do the same on Mac OSX? Is there a d...