• @cvp yep...just realized that must be the reason, since CGFloat can be 32 or 64 bits, so isn't always compatible with a float.
    I just changed things to this:

    CGFloat_p = ctypes.POINTER(objc_util.CGFloat) CGGradientCreateWithColors = objc_util.c.CGGradientCreateWithColors CGGradientCreateWithColors.restype = c_void_p CGGradientCreateWithColors.argtypes = [c_void_p, c_void_p, CGFloat_p] locations = (objc_util.CGFloat * 2)(0.0,1.0) gradient = CGGradientCreateWithColors(colorSpace, objc_util.ns(colors), ctypes.cast(locations, CGFloat_p))

    and of course it works fine now. Should have realized that right away. I'll update the original thread as well.

  • @omz, anyway, I've filled in the form, so now you have one more Pythonista fan ready for beta testing! Keep up the good work!

  • @dgelessus said:

    Ah, that's an auto-generated header from a class dump or something like that. I was looking at the "real" headers from the iOS SDK, which use vector types. (The iOS SDK headers aren't available online, the closest thing you can see is Apple's online documentation for GKAgent2D.position.) I'm guessing that during compilation some "magic" happens to properties/methods that use vector types, and the result is what you see in the class dump header. You could try using the methods position_ and setPosition__ (note the extra underscores), which according to the class dump header use structs instead of vector types.

    Thank you very much, using the methods with underscore solved the problem!

  • Something like this should work:

    err_ptr = c_void_p() device_input = ObjCClass('AVCaptureDeviceInput').deviceInputWithDevice_error_(input_device, byref(err_ptr)) if err_ptr: err = ObjCInstance(err) print(err)
  • Nice! Very Interesting

  • Thanks a lot @dgelessus ! One cannot ask for a better answer!

  • Looks like this code does not work properly on 64 bit... i suspect the structure is not sized correctly..

  • It looks like you have a script of your own called ctypes.py in a "temp" folder. Naming your scripts like built-in modules is never a good idea, try renaming it to something like ctypes_tests.py (and restart Pythonista if that doesn't help right away).

  • I have updated the GitHub repo to represent the current work. I have more or less temporariely resolved the issue by calling reload(GLKit.view) in main.py how ever this is really only a temporary fix. I will look into some of the methods that omz uses to retain the globals/delegate methods.

  • if you change the retainme line so that it is stored in a built in package, it will ensure it does not get gc'd when rerunning. As is, when you click play again, it results in a crash, because the objc object still exists, but the callback doesn't.

    ui._retain_me = tabBar_didSelectItem_
  • This could be a great potential use case for In App Purchases in the future ;)

Internal error.

Oops! Looks like something went wrong!