• ryubai

    @JonB

    thanks.
    it seems not convenient for debug, and i still use objc_util as OC bridge.

    posted in Pythonista read more
  • ryubai

    @JonB

    run more than once will raise such errs,then how to solve?

    ctypes_patch.make_callback_returnable(CGSize)
    File "/private/var/mobile/Containers/Shared/AppGroup/02422888-CC52-45FC-BB53-72013D3F4AFA/Pythonista3/Documents/site-packages/ctypes_patch.py", line 128, in make_callback_returnable
    raise ValueError("The ctype {} already has a getfunc")
    ValueError: The ctype {} already has a getfunc

    posted in Pythonista read more
  • ryubai

    latest when i try rubicon_objc.
    the code below, run once is normal. run anther time will raise a err.
    how can i solve it? thanks in advance

    RuntimeError: An Objective-C class named b'Handler' already exists

    code:

    from rubicon.objc import NSObject, objc_method

    class Handler(NSObject):
    @objc_method
    def initWithValue_(self, v: int):
    self.value = v
    return self

    @objc_method
    def pokeWithValue_andName_(self, v: int, name) -> float:
        print("My name is", name)
        return v / 2.0
    

    my_handler = Handler.alloc().initWithValue(42)

    posted in Pythonista read more
  • ryubai

    @JonB @mikael @cvp and other dear friends

    Sincerely,many thanks to you all!
    i love to stay here.

    posted in Pythonista read more
  • ryubai

    anyone can help? please

    posted in Pythonista read more
  • ryubai

    @JonB

    thank you all

    when i overwrite a method requested a return type in a new class.
    number and string can be returned directly.
    cell object in tableview is returned in cell.ptr
    but how to return a CGSize structure?
    objc's CGSize does't work

    posted in Pythonista read more
  • ryubai

    @mcriley821

    it still can’t work.

    superclass=NSObject is default when new class is created.

    posted in Pythonista read more
  • ryubai

    i created a new class and add a function to methods.
    but it showed such error.
    how can i return cgsize correctly?
    thanks in advcance.

    TypeError: invalid result type for callback function

    def collectionView_layout_sizeForItemAtIndexPath_(_self, _cmd, _cv, _la, _ip):
    return CGSize(340,300)

    methods = [collectionView_layout_sizeForItemAtIndexPath_]

    DataSource = create_objc_class('DataSource', methods=methods, protocols=['UICollectionViewDelegateFlowLayout', 'UICollectionViewDataSource', 'UICollectionViewDelegate'])

    posted in Pythonista read more
  • ryubai

    @JonB

    thank you very much for detailed reply.
    i will have more tests and try to understand it indepth.
    maybe ask later when i meet new question,thank you again.

    posted in Pythonista read more
  • ryubai

    thanks to you all. sloved!
    and sorry for my wrong code format,i'll correct it in my next post.

    posted in Pythonista read more

Internal error.

Oops! Looks like something went wrong!