• @omz said:

    I can't test this right now, but I have a suspicion that you need to set the argtypes and restype properties of the ObjC method manually. The derivation from the protocols argument doesn't always work reliably if the protocol isn't used as part of Pythonista itself. I hope this makes sense.

    I completely forgot about argtypes and restype honestly. It makes sense, I will keep trying to find out correct argtypes. Thanks for your suggestion. Please let me know once you test.

  • @omz thanks for the feedback!

    Actually I was using the ui.Image.named() vs the native UIImage.named: so hopefully my approach will work in the future.

    As to the ui.View subclass, I tried that (see code below), but then SKView isn't shown until about 5-7 seconds after the View is presented. Touches do appear to pass through before showing. Any thoughts on why this would happen?

    Assuming you've saved my example above into SKExample.py then you can try the following code (which imports previous). I did move around the scene presentation but that didn't fix the delay issues.

    Also note that presenting the SKView this way seems to do something that causes a slowdown occasionally so you will need to kill the whole app.

    from objc_util import * import ui from SKExample import * class MyView (ui.View): def __init__(self): self.flex = 'WH' global skview z = ui.get_screen_size() self.background_color = '#b3cdff' skview = createSKView(0,0, z.width,z.height -64) sz = CGSize(z.width, z.height-64) scene = createSampleScene(sz) skview.presentScene_(scene) self_objc = ObjCInstance(self) self_objc.addSubview_(skview) def will_close(self): global skview skview.paused = True #skview.presentScene_(None) #skview = None if __name__ == '__main__': v = MyView() v.present('fullscreen')
Internal error.

Oops! Looks like something went wrong!