Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

android python scripting: GUI?

Are there basic GUI functions in SL4A? I'd like to run a python program on Android and would need a listbox and simple dialogs (display info and get input).

There seem to be simple dialogs, but I haven't found a listbox. If there isn't a listbox, I should be able to create one if there's the ability to write text and highlight rectangles to specified parts of the screen and react to the user touching the screen or typing (including knowing where the user touched or where the cursor is).

like image 711
foosion Avatar asked Sep 11 '11 13:09

foosion


2 Answers

Essentially there are three things you can do:

  1. If you just want simple Android lists and inputs, such as getting a user's input (e.g., a username and password) or showing a list of option to choose from, then there are some tutorials here: http://code.google.com/p/android-scripting/wiki/UiExamples

  2. If you want to show information (i.e., not have the user select it), you could try showing HTML in a WebView and respond via events: http://code.google.com/p/android-scripting/wiki/UsingWebView

    Doing this, you get limited functionality via events by using droid.eventPost(eventName,eventData); in JavaScript and droid.eventWaitFor(eventName).result in Python. You can then do whatever you want with the received data.

  3. If you're feeling brave, the latest unofficial release contains support for full Android layouts (ones made in XML, like those found in a native Android app). You can find a guide for that here: http://code.google.com/p/android-scripting/wiki/FullScreenUI

like image 55
ProfSmiles Avatar answered Oct 03 '22 02:10

ProfSmiles


If you want a python GUI solution on Android/iOS/Linux/Windows/Mac you can use kivy... its nice! kivy.org

like image 43
piertoni Avatar answered Oct 03 '22 04:10

piertoni