• @mikael I'm not very creative with these things - do you have some example code based on objc_util that I could translate to Rubicon?

    In general the syntax for classes looks like this:

    from rubicon.objc import NSInteger, NSObject, ObjCProtocol, objc_method WhateverDelegate = ObjCProtocol("WhateverDelegate") class MyCustomDelegate(NSObject, protocols=[WhateverDelegate]): # the protocols=[...] part is optional of course, if you don't need to implement any protocol @objc_method def someThing_didAThingWithCount_(self, something, count: NSInteger) -> None: print(something, count) something.delegate = MyCustomDelegate.new()

    The Python 3 type annotation syntax is used to set each method's return and argument types. You use regular ctypes type objects for the types, and Rubicon predefines some common typedefs like NSInteger. Anything you don't annotate is assumed to be an Objective-C object (ObjCInstance).

    Blocks are similar:

    from rubicon.objc import Block, NSInteger @Block def thing_callback(number: NSInteger) -> None: print(number) whatever.doThing("abc", withCallback=callback)
  • @happy_variable try the following instead of __init__:
    def __init__ (self, name, dration, from_brick):
    In python, class methods (except the staticmethods or classmethods) are called with the instance of the class as the first argument.

    EDIT: You will also need to replace SpriteNode.__setattr__(name, duration, from_brick) with SpriteNode.__setattr__(self, name, duration, from_brick).
    This is because SpriteNode.__setattr__ is a unbound class method.

  • @JonB , after a long afternoon of trying understand the side effects I was creating, I have decided to go a different way. It gets worse when trying to add functionality to the class, which is the main intent. I am not giving up. I just dont think its a viable solution. I know you did it in a limited context.

    I have thought of another way with just some wrapper functions. I am pretty sure i will be able to achieve almost all I wanted to do with a fraction of the code and side effects. Let's see 😱😳👍

Internal error.

Oops! Looks like something went wrong!