There is probably a way to read out the pressure sensor and the pedometer of the iPhone 6 using 1.6 beta's ctypes module. However, I understand too little of the API to get this from CMAltitudeData and CMPedometerData. Sample code for learning how such (or similar) tasks could be accomplished would be much appreciated.
Welcome!
This is the community forum for my apps Pythonista and Editorial.
For individual support questions, you can also send an email. If you have a very short question or just want to say hello — I'm @olemoritz on Twitter.
Posts made by DrNo152
-
CoreMotion data such as pressure and pedometer with 1.6 beta and ctypes?
-
console.open_in
Is it possible to bypass the iOS "Open in..." menu (called by 'console.open_in') if the bundle identifier 'com.xxx.yyy' of the app to be opened is known? (The app I want to open does not have an url-scheme...)
-
how to give focus to a textfield in the "Custom UI" action
Is there a way to give focus to a textfield in the "Custom UI" action other than manually tapping to it if it pops up? That is, I would like to tell the action to let the cursor blink and to show the keyboard right from the start.
-
RE: how to give focus to a textfield in the "Custom UI" action
Great, thanks. That does the job.
-
Bug report: pre ios7-style magnifying glass used in editor
In the editor the magnifying glass for making selections appears to be still of pre ios7-style. The new one is used for editing file names, though.
-
problems using Image.open with png file
The following code
from PIL import Image img = Image.open('test.png') img.show()
throws "
IOError: broken data stream when reading image file
". Reading the image from the camera roll works flawlessly, though:import photos img = photos.pick_image() img.show()
The first image prints as
<PIL.PngImagePlugin.PngImageFile image mode=RGBA size 152x152 at 0xDFB438C>
the second one as
<Image.Image image mode=RGBA size 152x152 at 0xDFB460C>
But
PIL.PngImagePlugin.PngImageFile
is a subclass ofImage.Image
and things likeimg.show()
should work in both cases. In fact, nothing seems to work with the firstimg
.A quick peruse of google seems to suggest that this might be caused by a
libjpeg
version problem.PS: It used to work with Pythonista 1.3.
-
RE: problems using Image.open with png file
Yes,
img.format
is set to 'PNG'.Your code, however, is a working fine and can be used to create a new .png file that can successfully be dealt with. Kind of weird, though. Why wouldn't it work if saved directly by a dropbox sync?
Thanks for the workaround, ccc.
-
Action menu entry 'Run selected lines'?
How would one code a script that would work like the menu entry 'Run selected lines' in IEP when called as an action menu entry from the editor? All definitions made in the snippet should be referable in the console afterwards.
-
RE: Action menu entry 'Run selected lines'?
Thanks for changing this in 1.4. The following simple action does now the trick:
# run selected lines import editor import console text = editor.get_text() selection = editor.get_line_selection() selected_text = text[selection[0]:selection[1]] exec selected_text in globals(), locals() console.hud_alert('finished','success',0.5)
-
How to install a package like sympy?
Sorry if I rehash old questions but I could not find an answer (btw the forum search seems to be broken, there comes an 'https://accounts.google.com' page): is there a non-expert way to install a python package like sympy? The install instructions are: (a) extract and download to a folder called “sympy” (I would know how to do that using iExplorer); (b) in a terminal execute 'python setup.py install' (how would one do this?). Supposedly it does not work this way with Pythonista. Is there an alternative/workaround?
-
RE: How to install a package like sympy?
Awesome, thanks: along these lines I have now also installed the 'mpmath' package.