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.
Time to release a new version to App Store
-
@Matteo I understood that I can only install pure python modules and I think it is good enough for most of us. I hope pythonista can upgrade the modules like numpy, PIL and others. And I'm waiting for the features about siri. And I think all of you have seen that many people are still waiting for Pandas.
-
@cvp Hi, but which tool do you use to learn objc using only Pythonista? Any particular library written by someone here? Where do you find documentation about it? And can you make experiments in a protected environment (any sandboxed environement inside Pythonista main folder) on your idevice without risks to delete anything if some objc tests are not what you expected? only to learn something, not to become a objc guru :-)
@lpl Hi, yes I'm agree with you about some old not-pure python libs, but only if you need to use some extra-new features of the new versions of numpy, matplotlib, PIL, ... I mean, about your use of Pythonista, really you need new features of new libraries versions listed by you or you can do what you want with the old ones built-in? For example, which kind of great new features the new version of numpy can offer compared to version 1.8.0 version of Pythonista? Remember, also if you had the newest version of numpy on Pythonista, you could not install anything not-pure python that requires the last version of numpy, and any pure-python library that requires the last version of numpy could be modified to be used with the old built-in numpy version (not always, you are right, and only if you know how to modify it, but generally it is possible).
About Siri, which kind of innovation could exist for people who write python scripts with Pythonista? You know, about Siri I'm still waiting for Apple to add in iOS a feature that allows me to automatically answer incoming calls with Siri and to end a call at any time when I say with my voice a word that I saved in a Siri database (but it doesn't exist)... Sorry but I can't see any great advantages in developing Siri capabilities in Pythonista, can you suggest me someone? In my opinion it is better if someone could create an interface to use Pythonista on any computer with big screen, with a bluetooth connection (for example). I mean, I would use more and more Pythonista if I could link it to any computer that I use in order to use big keyboard, mouse, big screen, and to have on computer screen all keys, buttons, windows that I see on my iphone when using Pythonista.
Regards
Bye -
@Matteo The doc I use is only the Apple developer doc...You find there all classes documentation.
Often, I only type dir(ObjCInstance(any Pythonista object)) and I spend some time to check the methods and properties listed -
@Matteo You can't imagine what you can find with our big friend Google
Try this little script, only to see what you could do with Pythonista
And read this interesting topic and this one# https://rambo.codes/ios/2019/01/11/hacking-with-private-apis-on-ipad.html import ui from objc_util import * NSBundle = ObjCClass('NSBundle') UIWindow = ObjCClass('UIWindow') UIColor = ObjCClass('UIColor') window = UIWindow.new() window.setBackgroundColor_(UIColor.darkGrayColor()) NSBundle.bundleWithPath_('/System/Library/PrivateFrameworks/SpringBoardUIServices.framework').load() controller = ObjCClass('SBUIPowerDownViewController').new() window.setRootViewController_(controller) window.setHidden_(False) def close(): window.setHidden_(True) ui.delay(close,5)
-
@Matteo Like this? https://pillow.readthedocs.io/en/stable/releasenotes/3.4.0.html#append-images-to-gif
And for siri, we can get weather from different resources. Or we just roll the dice to make a decision.
-
@lpl said:
for siri, we can get weather from different resources
Sorry, I don't understand what you want to do with Siri
-
@cvp
-- Hi, siri how is the weather?
-- Here are some reports from different resources.-- Hi, siri. Should I go with her?
-- I roll the dice. The answer is yes. -
@lpl I think you can do that with the beta version, isn'it?
You have even Examples/Roll Dice.py
-
@cvp yeah. I'm using this.
-
@lpl you can use requests to get internet info in Shortcuts, even in background mode
#!python3 import requests import shortcuts def main(): if shortcuts.is_shortcut(): #shortcuts.set_tap_action(shortcuts.ACTION_SHOW_RESULTS) url = 'https://www.google.be/search?client=safari&q=meteo+local' r = requests.get(url) html = r.text shortcuts.set_html_output(html) if __name__ == '__main__': main()
-
@cvp Sorry, I don't like shortcuts and it is hard to debug on shortcuts. But I think I'll try this, that sounds interesting. Do you have a documentation about this module?
-
@lpl It is a standard module of the beta version.
Thus you find documentation by the normal way:- select the word shortcuts in your edited script, choose help, as usual.
- Or the ? In the console part, then "Whatβs New in Pythonista"
Edit: shortcuts is not the Apple app Shortcuts but a module added by omz in the beta, thus is not difficult to debug. In background mode = without running the full Pythonista app.
-
@lpl you can even run a Pythonista script with Siri without using the new Shortcuts module:
#!python3 import ast import requests #import shortcuts city = 'Waterloo,be' url = "http://api.openweathermap.org/data/2.5/weather?q="+city+"&APPID=beb97c1ce62559bba4e81e28de8be095" r = requests.get(url) dict = ast.literal_eval(r.text) for k in dict: print(k,dict[k])
Edit: you can run and thus test this script in Pythonista normal mode, then configure as a Siri shortcut linked to a sentence, like "get my weather"...
-
for key, value in requests.get(url).json().items(): print(key, value) # or print(f"{key}: {value}")
-
@ccc I knew there was something better π
Edit: print(fβ{key}: {value}β) Refused
Edit: invalid double quote
print(f"{key} : {value}")
-
Thx. Fixed inline above.
-
-
import location, requests, speech loc = location.reverse_geocode(location.get_location()) city_country = "{City},{Country}".format(**loc[0]) print(f"Weather in {city_country}:") url = "http://api.openweathermap.org/data/2.5/weather?APPID=beb97c1ce62559bba4e81e28de8be095&q=" weather = requests.get(url + city_country).json() for key, value in weather.items(): print(f"{key}: {value}") speech.say(f"It is currently {weather['weather'][0]['main']} in {city_country}.")
-
@ccc if you want to use Siri shortcut, you can, instead of speech, use
shortcuts.set_spoken_output(f"It is currently {weather['weather'][0]['main']} in {city_country}.")
-
@lpl yes, for me this is ok and better than my ..."+city+"... thanks for advice
city = 'Waterloo,be' url = f"http://api.openweathermap.org/data/2.5/weather?q={city}&APPID=beb97c1ce62559bba4e81e28de8be095"