• JonB

    @Phuket2 Also, really those two methods should just be part of the blunobeetleview class, which avoids having to use globals.

    posted in Pythonista read more
  • JonB

    where code is provided. remember you need to provide anither method to close or else you have to force quit when you are done

    posted in Pythonista read more
  • JonB

    @smiddleton In my example, the button action was set to the a() method. In your case, you would set self.b.action= forward_button

    posted in Pythonista read more
  • JonB

    Slight modification to your code, but not tested.

    import cb
    import ui
    class MyCentralManagerDelegateView (ui.Viee):
        def __init__(self):
            self.peripheral = None
            self.charactetistic= None
        def did_discover_peripheral(self, p):
            if p.name == 'HM-10-BLE' and not self.peripheral:
                print 'Discovered ' + p.name
                self.peripheral = p
        def did_connect_peripheral(self, p):
            print 'Connected Peripheral ' + p.name
            print 'Looking for Service FFE0'
        def did_discover_services(self, p, error):
            for s in p.services:
                if s.uuid == 'FFE0':
                    print 'Found Service ' + s.uuid
                    print 'Looking for Characteristic FFE1'
        def did_discover_characteristics(self, s, error):
            for c in s.characteristics:
                if c.uuid == 'FFE1':
                    print 'Found Characteristic ' + c.uuid
                    print 'Writing H'
        def a(self,sender):
            self.peripheral.write_characteristic_value(c, 'H', False)
        def close(self):
    cb.set_central_delegate( v)
    print 'Looking for HM-10-BLE module'

    posted in Pythonista read more
  • JonB


    Generally this is unnecessary, as pythonista is pretty good about saving whenever the tab switches, script is run, etc. You cannot plan on NOT saving, u need to assume that anything you type is saved instantly, other than the limited ability to UNDO/REDO. A lot of people swear by workflow for deliberate version control. I use stash git, though it has a lot of quirks that can lead to loss of work.

    posted in General Discussion read more
  • JonB

    in the same way you store a refernce to the peripheral, store the characteristic, e.g. self.c=c. then you can call write_characteristic elsewhere .

    You will want to also initialize and store a refernce to your delegate, so you can refer to it in your ui code. You could also make your delegate a subclass of ui.View, in which case everything you need is stored together, in self.

    posted in Pythonista read more
  • JonB

    out of curiosity ... what is this going to become? a multiplayer game?

    posted in Pythonista read more
  • JonB

    What I mean is, the login code should be run in the UI portion of the code. Then once you are logged in, begin rendering the scene (using pause). Did you try the example above that showed use of pause?

    I would just worry about running anything blocking or time consuming within the update loop. I think your original code would have kept trying to login -- you should only send a single login request, and only retry with a timeout.

    posted in Pythonista read more
  • JonB

    this looks fairly memory and cpu intensive... i suspect this might be too much. Maybe try on a tiny image ?

    From App Extensin Programming Guide:

    Memory limits for running app extensions are significantly lower than the memory limits imposed on a foreground app. On both platforms, the system may aggressively terminate extensions because users want to return to their main goal in the host app. Some extensions may have lower memory limits than others: For example, widgets must be especially efficient because users are likely to have several widgets open at the same time.

    Your app extension doesn’t own the main run loop, so it’s crucial that you follow the established rules for good behavior in main run loops. For example, if your extension blocks the main run loop, it can create a bad user experience in another extension or app.

    Keep in mind that the GPU is a shared resource in the system. App extensions do not get top priority for shared resources; for example, a Today widget that runs a graphics-intensive game might give users a bad experience. The system is likely to terminate such an extension because of memory pressure. Functionality that makes heavy use of system resources is appropriate for an app, not an app extension.

    posted in Pythonista read more
  • JonB

    questions.data_source = questions.data_source = questionDel

    looks like copy and paste fail here. surely you meant delegate, not data_source for one of these. did_select is a delegate method.

    posted in Pythonista read more

Internal error.

Oops! Looks like something went wrong!