Out of curiosity... how much RAM does the Python interpreter need to run, i. e. how much does it use once it's started up and ready to run code? 10 MB really isn't a lot. This would be a situation where Lua would be a lot more suitable, after all one of its main features is that it is very memory-light.
@ccc Thanks for your response. It worked well, except that I couldn't get it to work without displaying the WebView, which I was hoping to avoid. I ended up using the method suggested by @JonB to get around this.
Did you write a corresponding sensors.py file? If you implement _sensors in C (or in Python, it doesn't really matter) that doesn't automatically create a sensors module. The point of having a native C module and a separate Python wrapper is so you can write parts of your library in Python, and so you can change the C interface without worrying about breaking user code. (Of course you'd still need to provide some backwards compatibility in the Python module.) The C library is still normally available to Python code as _sensors, the underscore is used as a convention to indicate that it is a "private" library that external code should not depend on.
sorry, one more question. if the problem is your main loop, you could kill your main loop's activity before launching the webbrowser; i.e check for a flag at the start if each loop, and make sure you delay long enough that the loop is done, or use a Semaphore, etc.
Ok, found a working solution in the MapView objc sample:
Need to use a dummy ui.Button and set the Python click handler function as its "action". Then can use the button as the target and sel("invokeAction:") as the action when defining the Objc accessory button.
@Webmaster4o , yeah, i understand. it does come down to personal things. but also I am 50, my eyesight is very bad. Also, i don't like the letterbox type feeling (16:9). But as i say, on the iPad pro, i could be ok with it. It was just the portrait mode was not just ok, but fantastic in Pythonista,for me!
yes it does appear that the "subview" of a navigationview in the ui editor sets the root view. But since you cannot easily access the rootview of a navigationview after it is created this leads to some awkward situations.
Here is a way to get the rootview of a nav view, which only relies on a small bit of gc magic:
o=[v for v in gc.get_objects() if hasattr(v,'navigation_view') and v.navigation_view==nv and not v.superview]
So, I found the problem. It was not a coding issue, really, but I did not see the forest for the trees. I mixed up two views and got confused. Thanks for your advice and I apologize for wasting your time.