Re: [Pyobjc-dev] CLLocationManager
Brought to you by:
ronaldoussoren
From: Ronald O. <ron...@ma...> - 2010-04-06 09:08:25
|
On 5 Apr, 2010, at 17:31, Stefan Sieber wrote: > Hi, > > I'm trying to use CLLocationManager from Python. Althoug I don't get an error, I also do not get any output. > > Does someone have some experience with this? I've two things to say: 1) There is 'pyobjc-framework-CoreLocation' that wraps the CoreLocation APIs. Using objc.loadBunlde works as well, but the CoreLocation wrapper makes the constants in the framework available and is more convenient to use ('import CoreLocation'). 2) You don't use an eventloop, which is probably why your callback doesn't get called. Ronald > > Brgds, > Stefan > > <python> > import objc > from Foundation import * > import time > > > objc.loadBundle("CoreLocation", globals(), "/System/Library/Frameworks/CoreLocation.framework") > > > class LocationDelegate(NSObject): > def locationManager_didUpdateToLocation_fromLocation_(self, manager, newlocation, oldlocation): > print manager > print newlocation > print oldlocation > def didFailWithError_(self, error): > print error > > delegate = LocationDelegate.alloc().init() > print (delegate) > myLocMgr = CLLocationManager.alloc().init() > print (myLocMgr) > myLocMgr.setDelegate_(delegate) > accuracy = -1.0 > myLocMgr.setDesiredAccuracy_(accuracy) > myLocMgr.startUpdatingLocation() > #time.sleep(10) > myLoc = myLocMgr.location() > print (myLoc) > </python> > ------------------------------------------------------------------------------ > Download Intel® Parallel Studio Eval > Try the new software tools for yourself. Speed compiling, find bugs > proactively, and fine-tune applications for parallel performance. > See why Intel Parallel Studio got high marks during beta. > http://p.sf.net/sfu/intel-sw-dev_______________________________________________ > Pyobjc-dev mailing list > Pyo...@li... > https://lists.sourceforge.net/lists/listinfo/pyobjc-dev |