+ 4
May I Say Your Name?
Having fun with the Python sl4a (scripting layer for Android) module. Unfortunately it doesn't work in the SL Code Playground but codes can easily be copied and pasted into the QPython app where they work just fine. https://play.google.com/store/apps/details?id=org.qpyt I'm amazed how easy it is to get an Android to speak. All you need is: import sl4a droid = sl4a.Android() droid.ttsSpeak("Hello World") For fun: https://code.sololearn.com/cI6Pp3ux939E Anyone know a Python way to access Windows?
4 ответов
+ 3
Do you mean "access Windows" as the OS of Microsoft?
... or more generally GUI (graphical user interface)?
... or even android dialog boxes through Sl4a?
> For Windows shell commands:
from subprocess import call
call("dir", shell=True)
... or one of the other ways foundable at this link:
https://stackoverflow.com/questions/89228/callin-an-external-command-in-JUMP_LINK__&&__python__&&__JUMP_LINK
> For GUI handling:
There are several frameworks/modules solutions, among which Kivy is croww platform and support android, but is only working with QPython2, and not with QPython3 actually, unfortunally :(
> For dialog boxes through Sl4a:
Check the reference of the Sl4a API UIFacade:
http://www.mithril.com.au/android/doc/UiFacade.html
... theorically, you can use an android webview to use it as GUI (using Html and JS) and communicate with Python through events. But there's some difficulty to close the android webview that I haven't you solve, as well as maybe some problems with events and probably some versions of android webview package, even if I have not use lot of time to try/test all that stuff ;)
+ 4
I'll post a question on stack overflow and report back.
+ 3
Thanks @visph. I was thinking Microsoft Windows OS. I would like to write equivalent Python code to access PC features like text to speech and get latitude and longitude from location services https://docs.microsoft.com/en-us/uwp/api/windows.devices.geolocation and do things with Windows similar to what this code does with Android:
https://code.sololearn.com/c9XX3Z6Jq1b6
+ 3
Seems specifical for Windows mobile devices ^^
I doesn't know if and how is available an API for scripting languages as for android, even not about Python implementations available on Windows phones.
On the other hand, on desktop version, I'm not sure at all that you'll find built-in equivalent text-to-speech API, maybe nor geolocalisation possibility...