• SteppenwolfUA

    Thank you, Ole! It worked like charm, which again proves the point that reading the docs isn't enough. You need hands-on experience. I was too dumb to put 2 and 2 together despite having read about the



    Your remark about redundant _objc_ptr was an eye-opener. I'm upset 'cause I spent quite some time to dig it out )))) Thanks again.

    posted in Pythonista read more
  • SteppenwolfUA

    Hello, everyone

    I've started dabbling with objc_util module by trying out sample code provided with Pythonista and reading iOS docs. I find the whole idea of using Objective C from Python exciting. I've managed to set a property like backgroundColor on ui.View. What's struck me is the long time it takes. Almost 3x as long as for normal ui.View. Besides, first I get the default 'vanilla' view and then it gets colored. Any ideas what I am missing here?

    from objc_util import *
    import ui
    import time
    # WORKS THE SAME WAY as in Myclass below
    #cl = UIColor.alloc()
    #cl = cl.init().initWithRed_green_blue_alpha_(.2, .3, .6, 1.).autorelease()
    class Myclass (ui.View):
        def __init__(self):
            #ui.View.__init__(self) #changes nothing
            ocv = ObjCInstance(self._objc_ptr)
            cl = UIColor.blueColor()
            ocv.backgroundColor = cl
    start = time.clock()
    v = Myclass()
    print time.clock()-start
    start = time.clock()
    v2 = ui.View()
    print time.clock()-start

    Thanx in advance.

    posted in Pythonista read more

Internal error.

Oops! Looks like something went wrong!