Updated 2016-11-05 22:07:21 by chw

RS 2013-12-04 - AndroWish is an Android app with Tcl/Tk 8.6.4 (formerly Tcl/Tk 8.4.20) (where Tk uses an X11 emulation on top of libsdl.org, good old Motif style ;^ and ttk), sqlite3, tkImg 1.4, and much much more:

Website incl. downloads: http://www.androwish.org

Old download site: http://www.ch-werner.de/sdltk/AndroWish/
% catch {package require .}
% llength [package names]

As the list is a bit lengthy, I put it on AndroWish and its 337 packages.

AndroWish was first announced and discussed on Tcl/Tk on android poll, but I (RS) think it really deserves a page of its own. This. The following contents were copied over from that page - newest first.

See AndroWish: Devices for a list of hardware it runs on.

See AndroWish: Documentation and borg for commands and events specific to the Android environment.

Report bugs using the ticket system on http://www.androwish.org

GWL Other related pages, last updated 2014-03-08:

chw update on 2016-11-05: The "Bonfire Night" release (2016-11-05) is out: This is the 3rd anniversary edition of AndroWish featuring Tcl/Tk 8.6.6, SQLite 3.15.1, and tksvg. Many other packages are updated to newer versions, too. The undroidwish based builds now contain the same subset of BLT (barchart, graph widgets) as AndroWish.

chw update on 2016-08-15: "The Wow! Signal" release (2016-08-15) is out: This is an update release featuring Tcl/Tk 8.6.6, SQLite 3.14.1, and LibreSSL 2.2.9. Many other packages are updated to newer versions, too. The undroidwish based builds now contain TWAPI/WiTS (Windows versions) and broader support for video capture (both, Windows and Linux).

chw update on 2016-04-23: The "El Caballero de la Triste Figura" release (2016-04-23) is out: This is an update release featuring Tcl/Tk 8.6.5 and SQLite 3.12.2. Some other packages are updated to newer versions, too (SDL 2.0.4 plus patches, tcllib, pdf4tcl). OpenSSL is replaced by LibreSSL 2.2.6 and TkHTML 3 is added.

chw no update on 2016-01-21, however, something else crept out of the incubator. AndroWish now has a little sib called "undroidwish", more information on


chw update on 2015-12-18: The "Caractacus Potts" release (2015-12-18) is out: it is mainly a bug fix and update release. Some packages are updated to newer versions (SQLite 3.9.2, gridplus 2.11, icons 2.0, libpng 1.2.54), the "ble" command and underlying infrastructure is more stable, the "borg" command is improved and allows now to turn Bluetooth on and off and to send SMS. The tkpath widget combined with pdf4tcl now can generate PDF documents from most supported item types including alpha blending and color gradients. The AndroWish SDK [1] is improved and now able to run on all supported Tcl/Tk desktop platforms.

chw update on 2015-10-21: The "Back to the Future" release (2015-10-21) is out: it adds full Unicode 8.0 support including Emojis by using 32 bits for the internal representation of Unicode codepoints and up to 4 byte long UTF-8 sequences (potentially incompatible with Tcl versions on other platforms, see Why AndroWish switched to TCL_UTF_MAX=6). An initial AndroWish SDK [2] is provided which simplifies packaging of user defined trimmed down APKs (Android packages). The tclepeg package has been added to make JPEG files into thumbnails. Some other packages are updated to newer versions: SQLite 3.9.1, BWidget 1.9.9, and RAL 0.11.7.

MG I haven't gotten around to trying the new "bones" program yet, but reading the description on that page, it sounds awesome; thanks very much!

MaxJarek I tested AndroWish SDK on Windows 7 with Android Studio. Works fine and i can generate APK.

MG Could you post detailed instructions on what you did? So far all the instructions are for building on Linux, AFAIK.

NB Here's what I did.

1. Installed standalone android sdk tools

2. Installed apache ant binary

3. Have Java jdk 8.xx already installed

4. Unzipped the AWSDX zip file

5. added to environment variables

ANDROID_HOME c:\android\android-sdk

ANT_HOME c:\android\apache-ant-1.9.6

JAVA-HOME C:\Program Files\Java\jdk1.8.0_66

JDK_HOME C:\Program Files\Java\jdk1.8.0_66

6. add c;\android\apache-ant-1.9.6\bin to PATH

7. Added Platform tools and Build tools to Andoid SDK with Android SDK-Manager

8. Added Android 4.0.3 (API 15) and Android 6.0 (API 23)

9. Ran "wish bone" in the AWSDK/tools directory

I just rebuilt the standard androwish.apk as a test and it worked.

All the above is in the directions at the androwish site

chw no update on 2015-09-29, and no new version, either, but a new experimental feature: the beginning of an SDK is described in [3] where you can find a download link of its current instantiation.

chw update on 2015-08-22: The "Something wicked this way comes" release (2015-08-22) is out: This release adds various new "borg" minor commands, e.g. to read images from the device camera(s) into Tk photo images, VecTcl 0.2, and interfaces to the ZBar and libdmtx barcode scanners. SQLite is updated to version Subpackages were updated to newer upstream versions, and many bugs were fixed.

chw update on 2015-06-16: "The Blues Brothers" release (2015-06-16) is out: It adds a Muzic compatible MIDI sound package to AndroWish. SQLite is updated to version The tkpath widget and Bluetooth Low Energy module have been improved. Bugs in the Xlib emulation have been fixed. The "borg" command supports the new minor commands "trace" and "brightness".

chw update on 2015-04-23: The "Don Quixote" release (2015-04-23) is out: it adds support for Bluetooth Low Energy (aka Bluetooth Smart or Bluetooth 4.0) and the tkpath widget to AndroWish. SQLite is updated to version 3.8.9. Many bugs in the Xlib emulation and in the ZIP virtual filesystem have been fixed. TrueType font rendering speed for Tk widgets is improved. The "borg" command supports the new minor commands "broadcast", "providerinfo", and "queryconsts".

chw update on 2015-03-14: The "Pi Day" edition (2015-03-14) is out: This is mainly a bug fix and update release. Many little annoying problems in the Xlib emulation and in AndroWish startup were fixed: transient window handling, mouse/touch coordinate translation, loading of supplemental Java classes for Bluetooth and USB, etc. Many packages are updated to newer versions: Tcl/Tk 8.6.4, SQLite, tls 1.6.4, TclWS 2.3.8, itcl 4.0.3, itk 4.0.1, OpenSSL 1.0.1l, curl 7.41.0, tdbc* 1.0.3, and thread 2.7.2. The "borg" command has some new minor commands "systemproperties" and "phoneinfo" plus phone related virtual events.

chw update on 2015-02-02: The "Groundhog Day" edition (2015-02-02) is out: This release adds expect 5.45.2 and support for joysticks/game controllers to AndroWish. Many packages are updated: SQLite including the ICU extension, nsf 2.0.0, tkimg 1.4.3, tls 1.6.4, trofs 0.4.8, and tklib to its latest upstream version. Some bugs in the X11 emulation are fixed: listbox selection, font metrics, dashed lines, various crashes. The built in ZIP file system is improved and fixes long standing issues with glob -directory.

chw update on 2014-12-30: The "Peter Pan" edition (2014-12-29) is out: this is mainly a bug fix release which improves stability of the 3d canvas widget, fixes "wm attributes -fullscreen" and on-screen keyboard handling, and adds proper support of the "sdltk screensaver" command. SQLite is updated to version, and the mentry and tablelist packages to their latest upstream versions. A seperately packaged TkChat for Android is available which needs an installed AndroWish on the device.

chw update on 2014-12-07: The "All things are full of fools" edition (2014-12-07) is out: Stultorum plena sunt omnia (Marcus Tullius Cicero). Tcl and Tk are updated to version 8.6.3, SQLite to version The brand new feature: drh's 3d canvas widget now runs on Android! It uses an OpenGL to OpenGLES 1.1 emulation layer and renders to an off-screen texture which later is copied into the framebuffer and displayed by SDL which on most modern tablets/smartphones uses OpenGLES 2 for this task. YMMV in terms of stability of the 3d canvas depending on the quality of the device vendor's OpenGLES implementation.

chw update on 2014-11-05: "The Gunpowder Plot" edition (2014-11-05) is out. Remember, remember AndroWish's first anniversary. The root window now can be zoomed and panned with two and three fingers, respectively. SQLite is updated to and threading support is more stable.

chw update on 2014-09-30: "The Flintstones" edition (2014-09-30) is out: tclral updated to 0.11.2 and (Yabba dabba doo!) the X11 emulation is thread safe now allowing to have more than one Tcl thread perform a "package require Tk".

chw update on 2014-09-16: "The Great Moon Hoax" edition (2014-09-16) is out: Tcl/Tk updated to version 8.6.2. Packages tclxml, snack, tclws, tclsoap, and vu widgets added. New virtual events and commands to deal with GPS/NMEA and tethering information. Drawing/rendering now performed in RGB888 instead of RGB565. For updated documentation refer to the Wiki pages on http://www.androwish.org

chw update on 2014-08-17: "The Wizard of Oz" edition (2014-08-17) contains updated versions of SQLite (3.8.6), OpenSSL (1.0.1h) and various enhancements regarding screen rotation, sensor interface, screen resolution dependent icons for dialogs. The main site now is http://www.androwish.org with source code, documentation, and Android packages. Enjoy!

chw update on 2014-07-28: The "Alice In Wonderland" edition (2014-07-28) contains improvements in key mapping for external keyboards, improved themes for screen resolutions less than 140 dpi and greater than 240 dpi, various Xlib emulation bug fixes and a VNC viewer based on the code from http://www.ch-werner.de/tkvnc. The source code is now available in a Fossil repository on http://www.androwish.org thanks to drh.

JM maybe a link to http://www.ch-werner.de/sdltk/AndroWish/ from http://www.androwish.org will be useful?

chw update on 2014-07-06: The "A Hard Day's Night" edition (2014-07-06) contains improvements in key mapping for external keyboards, better look of radio and checkbutton indicators, tls update to version 1.6.3, and Harald Oehlmann's zint extension for barcode creation.

chw update on 2014-06-21: The "Manu Chao" edition (2014-06-21) contains improvements in angled font rendering and borg speechrecognition.

chw update on 2014-06-07: The "Alan Turing" edition (2014-06-07) fixes various bugs in the usbserial command. SQLite is updated to version 3.8.5.

chw update on 2014-05-31: The "Max Headroom" edition (2014-05-31) adds the borg log, borg screenorientation, and borg sensor commands, improves borg notification, repairs problems in TclUDP and usbserial, and includes TclCurl.

YS This edition also fixes all the bugs I've reported, so encoding names and file copy now work ok, too. Thanks, chw!

scotty 2014-05-13 The source (http://www.ch-werner.de/sdltk/AndroWish/) is down. Does anyone know of another download source?

AMG: It works for me. No, I don't know of any mirrors.

AMG: By request, I made a mirror of Let It Be here: [4]. This mirror may be temporary, as it only needs to serve until scotty's network issue is resolved.

chw update on 2014-05-13: The "Let It Be" edition (2014-05-13) adds the borg usbdevices, and usbserial commands, updates TclUDP to 1.0.10, and fixes interp eval .. {package require Tk}.

chw update on 2014-04-30: The "Walpurgis Night" edition (2014-04-30) adds the borg alarm, borg speechrecognition, and borg onintent commands plus further fixes in the SDL X11 emulation layer. Due to refactoring of the interface to Android activities (borg activity command got one more parameter) older scripts need be updated.

chw update on 2014-04-15: The "Leonhard Euler" edition (2014-04-15) adds dropbear (small SSH daemon with SFTP) and contains numerous cleanups in the SDL X11 emulation when compiled for desktop systems. Dropbear makes life hopefully somewhat easier for transferring files from your development machine on the device and vice versa.

My .wishrc for interactive use of AndroWish reads now:
  # start socket for tkcon
  # when used over ADB USB debug connection
  # the TCP port 12345 must be forwarded using
  #   adb forward tcp:12345 tcp:12345

  catch {
    package require tkconclient
    tkconclient::start 12345

  # start dropbear SSH/SFTP daemon
  # when used over ADB USB debug connection
  # the TCP port 12346 must be forwarded using
  #   adb forward tcp:12346 tcp:12346
  # the public key of the development system
  # must have been copied to $env(HOME)/.ssh/authorized_keys
  # of the Android device. $env(HOME) is usually
  # /data/data/tk.tcl.wish/files

  catch {
    exec librun.so libdropbear.so dropbear_main -R -p 12346

  # other goodies accessible through librun.so
  # tclsh:        librun.so libtcl.so tclsh ...
  # sqlite3:      librun.so libtclsqlite3.so sqlite3_shell ...
  # ssh:          librun.so libdropbear.so cli_main ...
  # scp:          librun.so libdropbear.so scp_main ...
  # dropbearkey:  librun.so libdropbear.so dropbearkey_main ...
  # curl:         librun.so libcurl.so curl_main ...

With this .wishrc, I can start tkcon on my desktop and attach to AndroWish through a socket connection. Using SSHFS/Fuse, I can connect to dropbear on the device and transfer files. In theory, WinSCP can do that, too, but I didn't test that yet.

chw update on 2014-04-04: The "Max and Moritz" edition (2014-04-04) is a bug fix release repairing the file dialog box and libSDL startup in the Android 2.3.3 emulator. SQLite is updated to version and the tbcload 1.7 extension has been added.

chw update on 2014-03-24: "The Dark Side of the Moon" edition (2014-03-24) now uses the latest libSDL 2.0.3 and fixes numerous small annoyances (tktreectrl scrolling, CJK text input (thanks hkoba), font fallback, etc.). A new borg minor command named withdraw has been added in order to put the application screen into the background. And it got a brand new icon designed by JM, thank you very mucho.

chw update on 2014-03-15: "The Ides of March" edition (2014-03-15) adds Tix (a bit unstable, but long live anachronism!) and fixes some drawing problems. The window manager decorations now take the pixel density into account, too. The packages sqlite and nsf are updated to their latest versions. A new borg content minor command has been added in order to access Android internal databases such as system settings, contacts etc. The default ttk theme is now droid which was derived from the plastik theme.

chw update on 2014-03-03: the "Pioneer 10" edition (2014-03-03) adds a usable subset of BLT2.4z (graph, stripchart, barchart, vector, spline) and fixes many bugs. The default font sizes now are chosen based on pixel density and should make things more readable even on XDPI devices.

JM 3/15/2014, I just tried the first example on playing BLT and it works.

chw update on 2014-02-22: the "Heinrich Hertz" edition (2014-02-22) adds touchscreen translation for scrolling listboxes, entries, and text widgets, an emulation of the right mouse button and a new virtual event <<PinchToZoom>>.

chw update on 2014-02-15: the "Galileo Galilei" edition (2014-02-15) makes things readable by default (at least on LDPI and MDPI devices no microscope needed anymore:). It includes sqlite and tcllib 1.16.

chw update on 2014-02-11: the "Thomas Alva Edison" edition (2014-02-11) fixes issues on Android > 4.1 regarding the borg shortcut command, adds the language, rate, and pitch optional parameters to borg speak, and adds as proof of concept some infrastructure to allow for building small standalone Tcl/Tk apps which use the AndroWish runtime environment, see http://www.ch-werner.de/sdltk/AndroWish/HelloTclTk for more details.

chw update on 2014-02-08: the "Jules Verne" edition (2014-02-08) fixes crashes in the borg bluetooth command, and adds the borg displaymetrics and borg osbuildinfo commands. See AndroWish: Documentation and borg for details.

chw update on 2014-02-05: the "Modern Times" edition (2014-02-05) updates SQLite to 3.8.3 and adds the borg toast command.

chw update on 2014-01-29: the "Dr. Strangelove" edition (2014-01-29) is a minor bug fix release fixing font rendering and URI parsing for launching scripts. Now, that AndroWish is almost three months old, please could somebody knit a really koooool icon for it (in different resolutions including full HD for posters, Retinas, and T-shirts, BSD or Creative Commons licensed, please) ?

With my Lenovo Ideatab A3000 (Android 4.2.x) I've successfully tested the AndroWish installation using this QR code (the device must be in development mode):

After install, the Widget Demo can be run using this QR code:

chw update on 2014-01-26: the "Leningrad" edition (2014-01-26) now includes most packages found in the "Batteries Included" version of tclkit. Please add missing packages/libraries in AndroWish Feature Requests. However, BLT/RBC will not be available soon, since it requires substantial enhancements in the Xlib emulation layer.

chw update on 2014-01-18: the "Amphetamine" edition (2014-01-18) fixes some crashes, repairs the broken tdbc package and adds tklib0.6 and vqtcl4.1 (parts of tclkit).

escargo 2014-01-14 - Could you say something about the requirements to run AndroWish? I have a tablet that seems to be Android 2.1. What versions of Android are supported/required/optimal?

chw the environment AndroWish runs on is SDL2 which requires at least Android 2.3.3 due to OpenGLES support for native code. Some non-essential features (external keyboard support etc.) work best on Android 4.0 or newer and may have restrictions on older Android versions. The APKs on http://www.ch-werner.de/sdltk/AndroWish/ are built for ARM and x86 processors, and should in theory run on more than 90% of Android (>= 2.3.3) devices.

chw update on 2014-01-13: the "James Joyce" edition (2014-01-13) repairs the broken thread and img::png packages and adds the vfs1.2.4 package.

chw update on 2014-01-10: the "Metropolis" edition (2014-01-10) as of 10th of January 2014 repairs the broken tls package and adds memchan2.3 and trf2.1.4 packages. EF Great, thanks for fixing tls. BTW, how do you prefer bug reports?

chw Please report bugs in AndroWish Bugs and AndroWish Feature Requests and/or send your patches directly to me (chw at ch minus werner dot de)

MG It would be really nice to see support for the vfs package, which is required for starkits, too.

chw update on 2014-01-05: the "Waiting For Godot" edition (2014-01-05) is the second version build with Tcl/Tk 8.6.1 and has most of the extensions packaged as in older 8.4.20 based builds: itcl4.0.0, tdbc1.0.0, thread2.7.0, tls1.6, tcllib1.15, tkcon2.7, udp1.0.9, sqlite3.8.2, tclmixer1.2.3, tdom0.8, tkimg1.4, and xotcl1.6.7. Compared to "Foucault's Pendulum" the build is cleaned up and Tcl threads are enabled.

chw update on 2014-01-03: the "Foucault's Pendulum" edition as of 3rd of January 2014 is the first version based on Tcl/Tk 8.6.1. The only extensions currently included are itcl 4.0.0, sqlite 3.8.0, thread 2.7.0, tdbc 1.0.0, and tcllib 1.15. More will follow in later releases, when the 8.6.1 port has been tested further. The Android-specific "borg", "rfcomm", and "sdltk" commands are present, of course.

Important: before installing the APK, ensure to have uninstalled prior versions.

escargo I was unable to post this question on the newsgroup.

I have downloaded, on a whim, BlueStack's app player [5], which emulates an Android platform on other systems, including my Windows 8.1 system. How would I get AndroWish on it to try it? EF Try Genymotion, you'll get better performance and AndroWish works out of the box on it.

chw update on 2013-12-27: the current version ("Johannes Kepler") has some minor bugs in the embedded ZIP filesystem fixed plus support for Bluetooth in the "borg" and "rfcomm" commands:
borg bluetooth devices

returns a list suitable for "array set" made up of Bluetooth address and friendly name of all paired Bluetooth devices.
borg bluetooth state

returns the current Bluetooth state ("on" or "off").
borg bluetooth scanmode

returns the current Bluetooth scan mode ("off", "passive", "visible", "connectable", or "on").
borg bluetooth myaddress

returns the Bluetooth address of the local default Bluetooth adapter.
borg remoteaddress address

returns the friendly name for the given Bluetooth address.

As for the network state a virtual event named <<Bluetooth>> is sent to toplevel widgets when the local Bluetooth adapter state has changed.

In order to transfer data over Bluetooth's serial port profile (SPP or SP) the "rfcomm" command was introduced. its arguments are nearly identical to the "socket" command and it returns a client or server channel handle to be used in further "gets", "read", "puts", and "close" commands. For client channels the remote address must be given as one or two element list. The first element is the remote Bluetooth address and the optional second element the UUID of the remote service. For server channels the rule is: first element is the UUID, optional second element the friendly name of the service. Unfortunately, I wasn't able to verify the server mode yet.

mh2 I can report that "borg notification" works perfectly on android 4.2, but not on android 3.2.2; the same can be said about "borg speach"; about binary packages, I think it would be good to add a package tcludp [6] if it is possible (it is needed when we want to use UPnP/internet of things, to do multicasting, etc...)

chw the "borg notification" depends on compatibility Java libraries for Android < 4.0 which were missing in all releases prior to "Foucault's Pendulum". The tcludp package will be integrated into some future release.

mh2 Would it be possible to add to androwish a package called "tcltcc" [7] ??? Tcltcc contains small C lang. compiler and is similar to "critcl" (allows to insert C code to Tcl code); it would be a "kitchen door" to all android C lang. libraries...; it would also allow us to eg. call functions from OpenGL library "with the speed of C code"; Of coures I realize that someone (tcltcc creators?) should switch something in tcltcc to generate code for ARM processor. Tcltcc seams to work well on linux, see example below, where I use SDL lib by tcltcc:
  tcc::cproc sum {int a int b} int {return a+b;}
  tcc1 add_library SDL
  tcc::ccode {#include <SDL/SDL.h>}
  tcc::cproc sdl1 {Tcl_Interp* in} ok {
    int i1; SDL_Surface *screen;
    i1= SDL_Init(SDL_INIT_VIDEO);
    screen= SDL_SetVideoMode(600, 600, 0, SDL_SWSURFACE);
    Tcl_Obj* ciag= Tcl_NewObj();
    Tcl_ListObjAppendElement(in, ciag, Tcl_NewLongObj( i1 ));
    Tcl_ListObjAppendElement(in, ciag, Tcl_NewLongObj( screen ));
    Tcl_SetObjResult(in, ciag); return TCL_OK;
  tcc::cproc sdl2 {Tcl_Interp* in} ok {
    Tcl_Obj* ciag= Tcl_NewObj();
    Tcl_SetObjResult(in, ciag); return TCL_OK;
  #% 0 140375792

chw nice idea, maybe feasible, however things get complicated:

  1. Although newer TinyCC versions can produce ARM code I wasn't able to build a working standalone TinyCC on Raspberry Raspian Linux.
  2. The three officially supported Android CPU architectures are ARM, x86, and MIPS. AFAIK there's no TinyCC support for MIPS.
  3. At least the ARM and x86 versions of TinyCC have to be packaged into the AndroWish APK, which already is at 10 .. 14 MByte.
  4. TinyCC is GPL which is incompatible with Tcl/Tk's BSD license.
  5. OpenGL support in Android on real devices is OpenGLES2, but not in all Android simulators.

chw update on 2013-12-19: the current version ("Pink Panther") on http://www.ch-werner.de/sdltk/AndroWish now uses the "DejaVu LGC" fonts again as did earlier versions. This saves some kByte in the APK file. The font selection mechanism now falls back using the Droid font from /system/fonts enabling AndroWish to display all Unicode labels of the widget demo properly.

The "borg" command now has the minor command "notification" in order to add/change/remove items in Android's notification area:
    borg notification add id title text
    borg notification delete id
    borg notification delete

where "id" is an user chosen integer identifying the notification. The "delete" sentence without "id" deletes all notifications. The "add" sentence with an already existing "id" modifies that notification.

chw update on 2013-12-15: the current version ("Freeman Dyson") on http://www.ch-werner.de/sdltk/AndroWish now includes tile 0.8.4. The "borg activity ..." command is improved to allow image capture. This enhancement is two fold:

  • the data type android.graphics.Bitmap in an activity result is converted to a JPEG image encoded as a base64 string.
  • the intent arguments (extras) in the fifth parameter of "borg activity ..." are key-value pairs where the values are mapped to Java strings by default. If the key is a 2 element list made up of a data type indicator {int,byte,short,char,long,float,double,Uri} followed by key the value is converted to that data type.

Sample code to capture an image:
    proc callback {retcode action uri mimetype categories data} {
        if {$retcode == -1} {
            # SUCCESS
            array set result $data
            if {[info exists result(data)]} {
                myphoto configure -data $result(data)
    package require Img
    image create photo myphoto
    borg activity android.media.action.IMAGE_CAPTURE {} {} {} {} callback

Unfortunately this makes only thumbnails and I've found no solution to specify the image size.

This works better but requires a file on external storage:
    proc callback {filename retcode action uri mimetype categories data} {
        if {$retcode == -1} {
            # SUCCESS
            myphoto configure -file $filename
            catch {file delete -force $filename}
    package require Img
    image create photo myphoto
    set filename [file join $env(EXTERNAL_FILES) myphoto.jpeg]
    borg activity android.media.action.IMAGE_CAPTURE {} {} {} \
       [list {Uri output} file://$filename] [list callback $filename]

mh2 above things are working again perfectly on android 2.3.3 ;-)); I will try to find other things that can by done by intents in this way, and will report them here...

GCS I am having a problem with global and variable. A code snippet that shows the problem is:
proc aa {} {
        global aaa
        set aaa(b) c

parray aaa

This gives the error: "aaa" isn't an array, but if the [parray aaa] command is entered after the error the correct output is given. The problem seems to be present in both Dark Star and Freeman Dyson.

A more complete example is
proc aa {} {
        global aaa
        set aaa(b) c
        puts "inside proc"
        parray aaa

set aaa(0) 1
puts "\nafter return"
parray aaa

which gives the output:
inside proc
aaa(b) = c

after return
aaa(0) = 1

I have not seen this listed as a known problem. I am running Android 4.1.2

Followup: Adding [global aaa] outside the proc fixed the situation.

mh2 It is strange - I dont see that problem on android 2.3.3/ tablet with 256MB of RAM; may be you should replace "parray aaa" by "puts [array get aaa]"? (it may be a console problem in parray??)

GCS I was completely misunderstanding the cause of the problem. The code I showed was in a small file being sourced. When pasted in it ran correctly. It runs correctly now (2014-02-16). My guess is that the implementation of source was missing [uplevel #0] when I had my problem in December. Anyhow, it is all good now.

chw update on 2013-12-14: the current version ("Dark Star") on http://www.ch-werner.de/sdltk/AndroWish now includes tdom0.8, xotcl1.6.7, and itcl3.4. It is now possible to run a script from e.g. ES File Manager or by using the "borg" to add a desktop shortcut icon to a script file:
borg shortcut add|delete icon-name argument

where "icon-name" is the icon's label and "argument" is the script to be run. However, it seems that the shortcut cannot be deleted on Android 4.x devices due to bugs in the launcher application.

Hopefully the issues on Android 2.3.3 with the onscreen keyboard as reported by mh2 are solved. I was able to verify this with the emulator only, all my real devices are Android 4.0 or newer. BTW: Android 2.3.3 is the minimum supported version due to requirements of SDL2.

mh2 Dark Star is working perfectly on android2.3.3 ;-)): (even without teaching phenomenology;-);) but I have next small question, I am trying to use camera, in this way:
  proc q1 args {global q1_var; set q1_var [info level 0]}
  borg activity android.media.action.IMAGE_CAPTURE {} {} {} {} q1

unfortunately, q1_var has value: "q1 -1 inline-data {} {} {} {data [email protected]}"; is there any possibility to read that bitmap (or get picture in another way??).

chw update on 2013-12-07: the current version now includes SQLite 3.8.2, tls 1.6, treectrl 2.2.10, and tkcon 2.7. The "borg" command now has
borg networkinfo

which returns the current network state, e.g. "none", "wifi", "mobile gsm" etc. This is accompanied by the virtual event <<NetworkInfo>> which is sent like <<DidEnterBackground>> to all toplevel widgets.

The SDL event pump has been modified in order not to block when another activity is started on top of AndroWish. That may consume more battery power as the thread running Tcl remains alive when AndroWish is in background.

As development aid the tkconclient from http://wiki.tcl.tk/14701 is built in. You can put this into your ~/.wishrc
    catch {
        package require tkconclient
        tkconclient::start 12345

That way AndroWish can be reached using tkcon's socket connection from a desktop computer. This works even through the USB debug connection, provided that TCP port 12345 is forwarded through ADB (Android Debug Bridge):
    adb forward tcp:12345 tcp:12345

Want to read barcodes from Tcl? Install the http://code.google.com/p/zxing barcode scanner and use the "borg" command to control it from Tcl:
    proc barcode_read {code action uri type cat data} {
        array set result $data
        if {[info exists result(SCAN_RESULT)]} {
            # that is the barcode

    borg activity com.google.zxing.client.android.SCAN {} {} {} {} barcode_read

mh2 Unfortunately, in Noam Chomsky edition, an on-screen keyboard does not pop up, when I click on entry widget or on console ... (android 2.3.3); and in the subject of tcl binary extensions in androwish: what do You think about adding: "tdom" [8], "XOTcl" [9], and may be "Itcl" (it is less important becouse there exists "tcl++", a scirpt-only impl. of Itcl...) ???

PO 2013-12-07: Older versions of my poSoft utilities run with AndroWish. See poSoft utilities on Android for screenshots.

chw update on 2013-11-29: the current version on http://www.ch-werner.de/sdltk/AndroWish now includes tkimg1.4 plus a star gate into the Android universe in form of a single command named "borg", e.g.
borg vibrate 500

turns the vibrator on for 500 ms.
borg beep

plays the notification sound.
borg speak "resistance is futile"

here you have it!
borg location start [minrate-in-ms] [min-dist-in-m]

begins acquiring location data (GPS, network, etc.)
borg location stop

ends acquiring location data
borg location get

returns location data in array set form, where the key is the location source. Location updates trigger a virtual event <<LocationUpdate>> (untested), which is sent to all toplevel widgets, which in turn should invoke "borg location get" to refresh their knowledge.
borg activity action uri type [categories] [arguments] [callback]

starts an Android activity with optional callback, e.g. "borg android.intent.action.VIEW http://wiki.tcl.tk {}" opens the browser on this wiki. Categories and arguments are optional lists, if a callback is provided, it is the command prefix which gets evaluated when the activity is finished (this is WIP and not very well tested).

Most of the ideas for this command were assimilated from the SL4A and Apache Cordova (PhoneGap) projects.

mh2 I have small question about "borg activity" command: after calling for example this command:
borg activity android.intent.action.VIEW http://wiki.tcl.tk text/html

androwish goes into background state and stops processing events (especially fileevents from socket connections to external servers) - it was tested on android 2.3.3; is there any possibility to cope with that problem? (may be by creating a second thread??)

chw see entry above (2013-12-07) should be fixed now.

mh2 It seems to me that events "LowMemory" and "Terminating" do not appear when androwish is killed by "oom killer", being in background (but it can also be a specific property of android 2.3.3 ??).

chw Same for Android 4.x devices. Both events are implemented in SDL2 but seem not to be reported.

MH2: May be it would be possible to integrate Hecl (http://hecl.org) with AndroWish??? hecl is a tcl-like interpreter written in Java (for android), it can use ALL Java classes; there could be a sub-intepreter called "hecl", and we could use it in this way:
hecl eval {
  set i1 [intent -new [list ACTION_SENDTO]]
  set u1 [uri parse "mailto:[email protected]"]
  $i1 setdata $u1
  [activity] startActivity $i1

of course, we can now run hecl in server mode, and connect to it by sockets from AndroWish, but it is not the same as "embeded" interpreter ...

chw: interesting idea, but what would be real embedded? There would be still that gap between the native world (SDL2 etc. plus Tcl plus Tk) and the Android universe. As far as I've understood SL4A and Phonegap, both use some RPC mechanism in order to carry out things in the opposite universe. Would that be different using Hecl? Naming those mechansims RPC IMO would have been better abbreviated with SWMWH (somewhat working magic worm hole ;-) Honestly, I've now my home work to learn more about Hecl.

MH2: why I think that hecl is better then sl4a:

  1. hecl can be embedded in the same process as AndroWish (sl4a uses external RPC serwer, clients must authenticate to that server, etc), see also "hecl embedding in java"
  2. hecl and real tcl use exactly(?) the same data structures (nested lists, dicts etc) so you do not have to use JSON to pass data from tcl to hecl and vice-versa
  3. hecl is an interpreter (not only interface), so it should be easy to interact with it - you simply send and receive strings ...
  4. sl4a does not provide 100% of Java API on android, on contrast to the hecl that can use all Java classes, see example below where I use sqlite from hecl:
  java android.database.sqlite.SQLiteDatabase sqlite
  set db [sqlite opendatabase "/mnt/sdcard/moje_pliki/q1.db" [null] CREATE_IF_NECESSARY]
  $db execSQL "create table q1(a,b,c)"
  $db execSQL "insert into q1 values (1,10,100)"
  java android.database.sqlite.SQLiteCursor cursor
  set cur [$db rawquery "select * from q1" [null]]
  $cur getColumnCount
    # 3
  $cur getCount
    # 1
  $db close

chw your database example reads beautiful and plausible. But how should the impedance mismatch between hecl (implemented in pure Java) and the native Tcl/Tk world be resolved? There once was TclBlend accompanied with at lot of TclBlend Problems which made that match but required a full Jacl in the Java universe (R. L. Stevenson would have called them Dr Jacyl and Mr Tycle ;-). Remember, AndroWish's heart is Tcl build from C source code plus Tk, SDL2, and Xlib replaced by AGG and some other glue.

MH2: ;-))); ok, I understand, thanks for Your replies ;-); but I think that it is more similar to the situations in the ".NET world" than in Java+TclBlend; there is an interpreter Eagle (https://eagle.to) written in C#, that can be embedded in real Tcl (using Garuda), and there is a command "eagle" that can be used to send scripts/strings from real tcl to eagle.

EF For those of you who wish to test applications, it is possible to to run AndroWish in the Genymotion emulator. It is just a matter of allowing installation from unknown sources and download and install the latest APK. You will then be able to run the emulator and type interactive commands in the console using your computer's keyboard.

EF So... now this is probably an Android question, but how do I modify the AndroWish.apk so that it contains my application (in the app directory, as described above) and still is a valid and working APK?? chw You'll need Android SDK and NDK preferrably on Linux, the AndroWish source archive, time and "ant debug" as described above.

chw 2013-11-16: the package is updated again. Some bugs are fixed ("wm attribute -fullscreen" handling, crashes when windows were closed before all pointer events were handled) and hopefully most of SDL2's APIs exposing Android specifics are available now (app life-cycle, accelerometer, finger events, power management info).

As a proof of concept these are available through "sdltk powerinfo", "sdltk accelerometer on|off" and a bunch of virtual events which get reported to toplevel widgets when bound. For a demo see the file "/assets/sdl2tk8.4/demos/ademo.tcl" in the http://www.ch-werner.de/sdltk/AndroWish/AndroWish-debug.apk (yes, it is a ZIP file).

Additionally I've added the 8.4 dict backport, tcllib1.15, SDL2_mixer and the TclMixer extension. Try "source /assets/tclmixer1.2.3/test.tcl" and you should hear your tablet playing music from Tcl/Tk.

I now own this kool K810 Logitech illuminati keyboard, too, but with German keyboard layout and it unfortunately works flawlessly with both a cheap rooted ARM tablet and an ASUS Fonepad with Atom processor. I'm still unable to reproduce AMG's problems.

RS Of course I had to download it immediately. sdltk powerinfo seems to work. I'm not sure what the accelerometer does. Very helpful: one can resize the console via
 console eval {wm geometry . 60x32}

Now to tweak its font a little bigger... {DejaVu LGC Sans Mono} 20 does the job for my old eyes on the 4" phone, with a geometry of 37x20. (That is character unitts - shouldn't wm geometry deal in pixel units?

chw: not when the text widget in the console engaded gridded geometry (text .sometext -setgrid true).

JM Nov-9-2013, Wow! Turtleshell also works nicely. squared buttons probably needed. - RS Thanks for testing it! I had forgotten it myself... ;^)

BTW, tcl_platform(platform) contains "unix", could we add the adjustment of this to the wish list? - RS Well, Android is based on a Linux (and hence Unix) kernel. As the tcl_platform page shows, there seem to be only three values for tcl_platform(platform): "macintosh" (ancient), "unix", "windows". More detailed is tcl_platform(os), where AndroWish has "Linux" (likewise in the Tclkit for Android from Roy Keene' nightly builds). Maybe "Android" would be clearer there.

nobel This great port of tickle to android deserves its own page now. I guess that's the way to go. For tcl/tk 8.6 will the themeing widget be like an android look-alike or will it be the widget themes from the unix port. I'm installing the android development tools so I can help in the development for the best I can. Socket programming without threads needed... Heaven! Even Hecl needed a threads. Thanks again for the great native port!

AMG: I'm using a Samsung Note 10.1 running Android 4.1.2. Don't know why my space bar doesn't work.

AMG, update 9 Nov, 2013: Now my space bar works, but all the alphanumerics are ignored! Backspace, left, right, enter, and space work, but nothing else, as far as I can tell. I should mention that I'm using a Logitech K810. Also, using Windows 7 Bluetooth Device Control works perfectly as a keyboard and mouse.

chw 2013-11-08 updated the package. It now has the environment variables ($HOME et.al.) set up properly in order to source .wishrc when in interactive mode as on other UN*Xy systems. $HOME happens to be identical with the app's internal storage path ("/data/data/tk.tcl.wish/files" which is writable). And that is also $TMPDIR (important for exec). <Space> now is no final frontier anymore, at least on my space cadet USB wireless keyboard. RS's idea with the .tcl file name extension associated to AndroWish is on my wish list, too, but seems to require heavy patching in SDL2. To exercise adding loadable extensions to AndroWish, the current SQLite 3 version is included in the package (try "package require sqlite3").

Now for the wish list in arbitrary order:

  • port to Tcl/Tk 8.6 (the code base now is 8.4.20)
  • make .tcl file association work (Android intent)
  • fix the SDL clipboard
  • glue to the Android world (ASE or PhoneGap)
  • have an easy day
  • find and hunt down bugs

What is needed to work on it?

What about making your standalone app?

  • add a directory below "assets" in the unpacked source tree called "app"
  • put your Tcl source code in "assets/app", the initial file sourced is "main.tcl"
  • replace "AndroWish" by the app name in various places I don't exactly remember
  • "ant debug" and test

RS Good news! Can't wait to test... but for your URL, T-online reports it is "currently not available". Have you been slashdotted/heised? :) You could directly upload the .apk to this Wiki. Create a new page like [AndroWish 0.3] (just click on one of the blue brackets), don't write in the edit window, but click on "Upload" below.

Big progress... .apk downloaded and running, Bluetooth keyboard works as announced (space, alphanumerics and all), cd ~ goes to the announced directory, package require sqlite3 reports 3.8.1.. now to write a .wishrc... :D

More progress.. wrote a trivial .wishrc ("puts hello") in /sdcard/home (because Jota+ doesn't let me edit in /data), let AndroWish copy it to $HOME, restarted.. and got "hello" :D Excellent.

For file transfer, I'd prefer my $HOME on sdcard0 or sdcard1 (those get mounted on netbook when USB-connected - but not /data and below that). Solution: I have a small file .wishrc in /data/data... which contains
set env(HOME) /sdcard/home
cd ~
source wishrc.tcl

And that latter file will contain the real customizing code. Ah, AndroWish surely is a beautiful thing :^D

  • sqlite3 is operable - tested with the "hello world" example at http://paste.tclers.tk/2947
  • changing the geometry of the console window seems not to work - I set it to 480x800, it reports 6269x16808 ...
  • adapting the console size seems not to work with
console eval {.console config -width 40}

chw 2013-11-06: a new improved version is available. It now supports screen rotation and has better handling of the onscreen keyboard. Just touch an entry or text widget (which is not disabled, of course) and the onscreen keyboard becomes visible.

The fonts now are full DejaVu incl. Arabic and Hebrew. As per SDL2-2.0.0 the minimum supported Android version is 2.3.3.

The debug APK now contains the shared libaries for x86, too (for you guys having Atom powered phones and tablets :-).

Sadly, the <Space> key on my wireless USB keyboard doesn't work either. And its keymap in my 4.0.1 tablet is weird ... and the SDL clipboard support crashes the entire application (therefore disabled) ... and most likely there are still hundreds other little bugs and annoyances.

There's still much to do ...

RS Please keep up the good work, chw! You made a dream of many Tcl/Tk users come true... :^) Update: the Rapoo keyboard now is recognized by AndroWish, except... for <Space>... but we're getting ahead :-D

Workaround for <Space>: in the new "portrait" format, we can leave the virtual keyboard up (using it only for <space>), and do the rest on the physical Bluetooth thing. Using the "Hacker's Keyboard", one can reduce the height of the keys so it takes up less than 1/4 of the screen.

I can also confirm that the virtual keyboard now comes up reliably whenever I touch an input field. Good job, chw!

chw that went magically, I suppose. I had similar effects with my wireless USB keyboard. It was recognized by the tablet but nothing happened in AndroWish and it suddenly worked (although it had not the proper keymap layout). Still unclear who's the culprit. Maybe some Android magic IME which does not well with SDL2-2.0.0.

JM agrees, as this is bringing fresh air to Tcl/Tk...Thanks.

EF has anyone come any far as to how to access the rest of the android platform? I don't even know if this is possible, but accessing things such as the values of the sensors, or being able to place notifications for example... Or force, follow, be notified of the current orientation.

RS See Android - An Open Handset Alliance Project for links to Pat Thoyts's activities to bring Tcl to Android, including its speech recognition and generation.

chw That ASE piece is IMO a rather complex thing which is required to get around missing Android introspection features (am I correct in this prejudice???). It might have the problem that for each new feature of the Android world someone has to enhance the ASE glue in order to expose that feature to the scripting world (am I correct in this prejudice???).

Parts of the sensors et.al. are right now exposed through SDL functions, thus it might be a task of adding calls to those functions in the C layer of Tk (the "sdltk" command) in order to read out the sensors. Regarding orientation I hope (didn't try that) that a <Configure> event handler on a toplevel with "wm attributes -fullscreen 1" might detect changes in screen orientation.

GCS The <Configure> event certainly does occur, and the orientation can be determined via [borg displaymetrics] , although there is probably some variable associated with the event that could be used. This is running Thomas Alva Edison on 4.1.2

RS I have one wish: is there, or can there be, a filename which, if existing, is sourced at startup time? For example, androwishrc.tcl? Users could put their initialisation there (change console font size, cd $HOME, whatever) to reduce typing.

ed.s I vote +one for this! Or a "settings" thingie. I would enlarge fonts in this way on those tablets (7" and up( that have the real estate).

And another: how does one associate AndroWish with .tcl files, so it gets called when they are touched in File Explorer?

ed.s Once, you can long-click and select Share to TclScriptLauncher. I have not figured out how File Explorer changes its associations. For example, I rename .tcl to ,txt to open it in an editor, then rename back to launch with TclScriptLauncher. It would be nice if AndroWish would declare itself as capable of opening .tcl files, for the File Explorer.

AM Just hopping on the bandwagon, I suppose, as I am utterly unfamiliar with the Android environment, but am intrigued by the possibilities of smartphones. I installed it, that was no problem at all, I could type some commands in the console and see the result in the main toplevel window, but I could not see the contents of the "data" directory - "permission denied". That made me think: how can you handle (source) files in this environment?

RS Android can be quite paranoid with user rights, and /data is the place where apps are installed. For me, AndroWish starts in /, and I put my scripts in /sdcard/home, where I have all privileges. (Most conveniently by USB-docking the phone to a PC, where its SD cards are mounted as external drives.)

AM Ah, so that is it. I would never have thought of looking there :). Thanks.

chw - 2013-11-05

chw: after lengthy preparation updating the SDL stuff from SDL 1.2 to SDL 2.0 I was able to build Tcl/Tk for Android. An early snapshot can be obtained from http://www.ch-werner.de/sdltk/AndroWish (source tarball and Android ARM debug APK).

Remember, remember, this is Tk natively on Android where the X11 drawing/rendering is replaced by AGG, freetype, and SDL thanks to an earlier effort of Tim Baker who did that some years ago for Win32.

AMG: Looks very promising. But there's a huge problem: the space bar on my Bluetooth keyboard isn't working. This makes it impossible to write anything more than "exit". Before you ask, the space bar works in other apps. Also, outside of using a proper computer to do it, I can't figure out how to save code from the Wiki to a text file suitable to be sourced. The closest I can come is appending ".code" to the URL which shows me the code, but Android browsers lack the ability to save anything they didn't think was a "download" to begin with.

LES: I think that copying and/or editing directly on the phone is very uncomfortable. You should install something like SSHDroid so you can SSH into the phone from your PC over Wifi and do everything in that terminal session. Or, if you insist on relying solely on the phone, you can install TextWarrior, select and copy all the ".code" from the browser view and paste into a new text file with TextWarrior.

EF yes!!!! Fantastic! And the space bar works on my nexus 7 without any problems...

nobel On my samsung note it works also fantastic. Very fast loading indeed! This is very useful. Editing on the device no problem Running as a TCP socket server, no problem. Great! Great! Great........! I tried on a cheaper tablet with only android 2.2 but it cannot parse the apk package after download.

nobel Did another test with canvas. Canvas items are rendered with antialiasing so its beautiful. Binding <B1-motion> on the items doesn't seem to work with touchscreen. But hey, this is already great.

JM it works on my cheap tablet with android 4.1.1

RS 2013-11-06 Seems to work (need more experimenting) on TrekStor Breeze 7" tablet, Android 4.0.4. Same on Huawei Ascend Y300 phone, Android 4.1.1. Wow! Big thanks! Updates:

 DejaVu LGC Sans
 DejaVu LGC Sans Mono
 DejaVu LGC Serif

  • Canvas animations: Toy cars, Postcard from Switzerland trains3.tcl work too (the latter is a bit slow...).
  • Only landscape orientation is available.
  • The virtual keyboard disappears when switching between apps, and I haven't found out yet how to get it back, other than kill and restart AndroWish... :-(

Maybe I should get a Bluetooth keyboard (but test before buying whether <Space> works :^)

Update: bought a Rapoo E6100 keyboard today. Beautifully designed, but: in AndroWish it does not deliver a single keystroke. In other apps (Terminal Emulator, Jota+ text editor) it works, but assumes US keyboard layout instead of the German QWERTZ I have. It's not only the Z vs. Y, many punctuations are in other places than seen on the keyboard, and it seems to be a black art to fix that... :-O

Milkman - 2013-12-17 01:22:17

Wishlist: tcl/tk stripped down with the intent that it be used by external code solely for access to Tk, and whatever extensions are interesting for use with Tk,or is it the case that AndroWish only loads extensions that the code calls for at runtime? Is the whole 20 meg package loaded into phone's memory?

AMG: You have to invoke [package require] in order to use a package. If you don't do this, it's not available to the interpreter and presumably not introduced into RAM. Whether or not a package is loaded, it's still present in the filesystem.

chw: another point adding a few megabytes to the APK is the fact that the package is built for both ARM and x86 due to the fact that one of my toys is an ASUS phablet with Intel Atom processor (is there anybody who has a MIPS based tablet out there?). On install of the APK (which has about 14 MB) the shared libraries are unpacked to the filesystem. This requires approx. 14 + 6 MB disk space on ARM and 14 + 10 MB on x86, finally.

Milkman - 2013-12-18 03:44:41

I'm new to android from a development standpoint. What would I need to do to interact with androwish from external applications? I am coming at this from the point of view of interacting with Tk from an external process (specifically a lisp runtime in my case) and having the binding code locate the tclkit runtime in the lisp image's path. Do I need to use android specific callbacks or interfaces to locate the tcl/tk runtime, or assume that the android package installs androwish (or the binaries) in a conventional location? Thanks all for your responses so far. I'm excited that tcl/tk has made it to android, and I look forward to using it!

nobel - 2013-12-18 15:20:00 You chw have done a very, very, very good job. How can we help you to get it even better? I tried the borg command and that's very nice! Only the borg speak command doesn't seem to work. I tried this on different tablets but speak is silent. It doesn't throw an error either. Keep up the good work. You are performing a milestone for tcl/tk. Can you imagine the possible marketshare you opened for the tcl/tk community? Hope it will turn developers to tcl/tk again.

chw thank you very much. I had similar problems. The cure for the borg's tongue was implanting a country specific text-to-speach module, but I don't exactly remember how. You should start playing with the language settings.

Superlinux - 2014-01-14 10:34:28

Thanks for the presence of Androwish. I ask : 1- how can I set a script to autorun at Androwish startup? You know.. if I sell a Tcl/Tk app to a customer, all the customer should do is just click on Androwish icon and the app runs. 2- Also how am I supposed to distribute my Tcl app on Google Play Store. Thanks.

Yet in the latest versions of January 2014, some packages are missing. package "tdbc" is there but has its *.so file missing to get it loading. package "mysqltcl" is not there. I noticed that package "tablelist" does not exist too.

Please show me a video guide uploaded on YouTube on how to build and add extensions to Androwish. thanks.

Also, I kindly ask your permission to let me publish the Androwish apk's on my Android Developer Console account. It will ease distributing and updating Androwish to those who use my tutorials to learn Tcl/Tk. My tutorials are packaged as Android applications. Also please provide a symbolic link to the latest version of Androwish, if you decided not to use my developer console account. Please email me with your decision. Thanks.

[GustavIvanovic] - 2014-01-24 03:35:52

Androwish is fantastic! It works well on my cheap HP Slate 7.

[Unperson] - 2014-02-04 18:06:00 Confirmed to run on my "Samsung S3 mini" Android 4.1.2 - no idea how to figure out the AndroWish build

escargo - I would be interested in seeing what hardware platforms and Android versions Androwish has been shown to work on.

MG 2014-02-04 Can anyone who has successfully compiled AndroWish post some detailed instructions? I've tried but haven't had any luck so far. I managed to import the source into the Android SDK's Eclipse editor, and after fixing a few issues (which mostly arose from it being set to the wrong version of Android to build for), I got it to compile, but it then crashes when I try and run it, saying it couldn't find the SDL library in the APK.

Info on what needs to be updated when you're wrapping your app would be handy, too - it looks like there are references to AndroWish in the actual source code (for the different pre-configured launcher events, 0-3, but I have no idea what the difference/point of those is).

chw please fetch the sources (the big .tar.bz2), unpack it, have Android SDK and NDK installed, don't use Eclipse, adapt local.properties to where you've installed Android SDK, have your PATH properly set so that ndk-build can do its job, then invoke "ant debug", be patient, and you'll finally will have bin/AndroWish-debug.apk ready to be installed onto your device. I have never verified the build process in combination with Eclipse. Once upon a time, I did my very first steps using the tips from the SDL documentation regarding Android.

When you want to wrap your own app written as Tcl code, you should add it below assets/app, have the launching script as main.tcl, fiddle the toplevel AndroidManifest.xml to have your app/class name in, remove that AndroWishScript/Launcher stuff from the manifest (since not needed for a standalone app), derive your app main class (yes, some Java required) from src/tk/tcl/wish/AndroWish.java, e.g.
  import tk.tcl.wish.AndroWish;
  public class TclTkRules extends AndroWish {}

fiddle the res directory with a new really kooool icon and title for your app.

Superlinux - 2014-02-05 16:01:54

OK. great work. Keep it on, brother. I have installed "Modern Times" edition, 2014-02-05, which is the latest with respect to this post. Well the console font needs a microscope to read it. :) Thank God I can still read without glasses. kindly please increase the fonts. I have 800x480 screen. I have no tablet. Arabic letters do appear now. but still I think I have to use my solution to re-render Arabic the correct way. They look separated letters and in reversed order.

chw well, the font rendering is straight forward as (I'm uncertain) in X11 (I'm open for better solutions, please send patches which are BSD licensed). Regarding font sizes you will see the same pixels on all devices right now, may it be a 1000 inch TV set or a über high resolution post retina display on a smartphone to fulfill wishes no eye before ours could have seen before. Good for us, that it's device independent. I'm open for alternatives but don't know how to keep otherwise portability (think of "that script I wrote 15 years ago still runs on my smartphone and behaves the same.").

Superlinux - 2014-02-05 16:32:26

There is the command source has some problem. let's say I have two scripts located in the same directory: main.tcl and config_include.tcl . now the normal way to include a config_include in main.tcl is:
source config_include.tcl

#rest of main.tcl code is here 
puts "yada...yada....etc..etc"

However in Androwish to reach and include config_include.tcl I must put the full path of the file as in:
source /sdcard/some/folder/config_include.tcl

#rest of main.tcl code is here 
puts "yada...yada....etc..etc"

I think this should be fixed?! not sure how much important this is.

AMG: [source], like all commands that open files, operates relative to the current working directory. What's the output of [pwd]? It's not necessarily the same as the directory in which your startup script is located.

If you want to load files relative to the location of your startup script, use [file join [file dirname [info script]] $filename] to get the proper name.

Superlinux - 2014-02-06 08:31:30

I think having a namespace with commands similar to Android SDK Java instruction: [Environment.getExternalStorageDirectory()] can do the job. let's say this is the skeleton of this namespace we call it "Environment" much like Android's. Therefore we get procedures of the same name of Android's. So it will be something like :

ed.s - 2014-02-07 23:38:35

Installed the latest AndroWish-debug.apk ("Modern Times" edition, 2014-02-05) on an HTC phone, Android 4.0.3

1. keyboard is stuck in uppercase, only in AndroWish. Downloaded GO keyboard, an acceptable workaround for this bug.

2. "borg bluetooth devices" at the prompt causes a crash, no visible errors.

Any suggestions?

chw 2014-02-08: on an HTC One V with Android 4.0.3 I can confirm point 2. Newer tablets with 4.1 (ASUS Fonepad) and 4.2 (Lenovo A3000) don't show this problem, however. Fix for crash is work in progress. I've never observed point 1. both on HTC and other devices.

Please report bugs on AndroWish Bugs.

ed.s 2014-02-08: Will do. An amazingly fast fix, Thanks!

ed.s - 2014-02-09 12:38:12

In the absence of rbc how can I issue an equivalent of system(gnuplot)? The executable and qt libs are available (and installed) from Ministro / gnuplot viewer but I cannot figure out how to find/invoke it. In tcl I would typically open a pipe to a persistent system call, and then write gnuplot commands to it, embedding the data within a character stream, something like this:

# plotting relies on gnuplot being externally available
  button .mbar.plot -image button_plot -command {
    set FP [open "| gnuplot -persist" w+]
    puts $FP "set data style linespoints"
    puts $FP "set xlabel \"Time, s\""
    puts $FP "set ylabel \"Mass, g\""
    puts $FP "plot '-' t \"m(t)\""
    foreach i $datalist { puts $FP $i }
    puts $FP "e"
    close $FP

chw: in theory you would do it in the same way as on other UN*Xen. But it requires that the gnuplot binary can be executed by the user under which the Android installer installed AndroWish, which is surely not the case. The only other way I can currently think of is to activate gnuplot through an Android activity, if gnuplot supports this, and transfer the plot data through a file, which in turn must be on some world readable filesystem (e.g. the internal or external SD card).

ed.s 2014-02-08: Er, did not get this bit about the same user. Gnuplot Viewer (http://mneuroth.de/projects/GnuplotViewer.html) does exactly that: it installs a set of libraries implementing Qt for Android and the gnuplot executable, then provides the front-end that allows you to enter commands into a script and then execute the gnuplot executable and pass the "commands" to it. In gnuplot, commands can contain "data", in the strings being passed (or we could use some temporary file in a world-accessible directory). The problem is that it's not /usr/bin/gnuplot but somewhere else [...edited...]

ed.s - 2014-03-05

Well, as it turns out, while the read access to the directories is restricted by Android, the execute access on the executable is world. This makes sense, since the programs ("apps") may need to invoke other executable programs ("share"). So, if you know the exact location of the executable, it will work as one would expect under a normal OS. I received help and permission from M.Neuroth [...edited...] and the following code works as expected:
   # gpsimple.tcl - a simple demo to plot within canvas using external gnuplot
   package require Tk
   # Linux
   ##set gpexe /usr/bin/gnuplot
   # Android, free version of Gnuplot Viewer
   set gpexe "/data/data/de.mneuroth.gnuplotviewerfree/files/gnuplot_android"
   # Android, premium version of Gnuplot Viewer
   ##set gpexe "/data/data/de.mneuroth.gnuplotviewer/files/gnuplot_android"
   # Windo$e
   ##set gpexe "C:/Program Files/gnuplot/pgnuplot.exe"

   eval [exec "$gpexe" << "
      set term tkcanvas
      plot sin(x),cos(x)
   pack [canvas .c]
   gnuplot .c

The last "gnuplot .c" is the tcl command created by the tkcanvas driver within and imported from the external gnuplot executable.

I have plotting within Androwish!

ed.s - 2014-02-09 12:55:41

I've been having a lot of fun with borg speak command. I have more than one language enabled, how do I select which one to use?

chw: right now the "borg speak" uses the selected language of the settings in the text-to-speach module. If possible that command will get another option to select the spoken language in one of the next releases.

ed.s: that would be fantastic, otherwise traipsing through the settings all the time would be a pain, in a multi-lingual conversation. Thanks.

ed.s - 2014-02-09 22:51:00

I must say, borg is a singularly useful set of extensions for people experienced in tcl, but not in Android paradigm. Bravo!

On the subject of communications: has anyone opened a /dev/ttyS0 with a USB-serial interface plugged into the OTG port? What brand(s) of USARTs work (e.g. FTDI) ?

chw: there's a github project https://github.com/mik3y/usb-serial-for-android which looks promising. However, a similar approach as for bluetooth has to be taken, since generic USB is exposed only on the Java layer, i.e. it seems impossible to directly open a POSIX tty from native code.

ed.s Thanks for the pointer, it does look intriguing. I am beginning to appreciate that Android has sacrificed so much of its Unix pedigree. That is why I am so hopeful that Androwish will replace all this app sandbox nonsense with something where I can focus on the function and not on the environment rules.

I am looking forward to testing out your new ttycomm command :)

ed.s - 2014-02-11 02:55:13

For some reason, there is no pinch zoom/unzoom within Androwish. Is this a limitation of the qt - no multi-touch?

ed.s - 2014-02-12 01:33:43

Edison edition: multi-language Borg speak works beautifully.


[KC] - 2014-02-12 15:17:32

Kc androwish regarding the command Borg speak-does it support locale zh_TW and zh_CN. I Tried but it does not work.

chw: please watch out for system notifications. It could be, that you have to download and install a specific text-to-speech module. Other option is to install an alternate text-to-speach module, see http://www.google.com/search?q=android+tts+chinese

GCS - 2014-02-18

I am starting a new wiki page that will document my progress with AndroWish and SQLite

Superlinux - 2014-02-26 05:24:00

Just for the record and archiving sake.. I am copying an email I sent to CHW with his reply. It had a confirmed bug. My words of the email start with the greater-than symbol (> ) :

> Rani Ahmed wrote:

> Hi. and thanks for AndroWish. Awesome work!!!

> I used and your steps in this page to build HelloTclTk:

> http://www.ch-werner.de/sdltk/AndroWish/HelloTclTk/

Howdy Rani,

> However, I really want to use Eclipse. I am planning to publish my Tcl/Tk apps on Google Play Store.

> I tried importing the project into eclipse. but every time I run my app it only runs AndroWish without running the script.

Confirmed, there seems to be a problem. The APK built by Eclipse is different from that built by Ant. And it confuses the ZIP mount code of AndroWish. I hope to have that fixed in the next edition.

> Would you please tell me the correct steps to use Eclipse to import or create the project HelloTclTk?

See above. When the ZIP VFS can deal with the Eclipse made APK it should work by just importing the unpacked HelloTclTk source archive. In the meantime, just use Ant.

Best regards,


eds - 2014-03-05 04:38:16

Wow, BLT! Out of curiosity, why not RBC? The last BLT isn't even compatible with tcl/tk 8.3 or above.

All of my scripts are RBC. I changed the package importation to BLT/blt/Blt_... and the scripts start (!)


Unfortunately, I am seeing some strange behaviour, and trying to track it down is proving difficult, as the exact same changes under Linux version of BLT 2.4z (from a SUSE 12.3 rpm) produce Segmentation faults, and editing and debugging on Android is a pain.

Under Linux, the seg fault is caused by
vector create ::re(2048)

The same line executes fine under AndroWish (!?)

On the other hand, binary reads from files are messed up under Android, and work fine under Linux.

Very confusing.

chw 2014-03-05: BLT2.4z which comes with current Fedora and Debian compiles relatively clean for Android with Tcl 8.6.1 and I've searched for a version which can easily be built with ye olde 8.4.20 if needed. Regarding problems and crashes: please put reproducible bug reports on AndroWish Bugs. Code snippets are fine, small excerpts from android logcat which might show SIGSEGVs, too. To simplify testing and debugging have you tried the above mentioned tkconclient method? This allows tweaking a running AndroWish from a desktop machine.

Superlinux - 2014-03-08 05:19:28

A question: Shouldn't I check if com.google.zxing.client.android.SCAN exists first before I can use the barcode scanner ZXING ? or does the code above suffice?

chw 2014-03-08: for a controversial view see Why AndroWish was a bad idea

ET - 2014-04-16 08:26:09

As a complete newbie on Android, here’s how I installed the AndroWish APK on my tablet computer:

  1. Visit http://www.ch-werner.de/sdltk/AndroWish/ on the android device (I used chrome) and choose the latest APK at the bottom, which is an installable file for Android.
  2. I simply tapped the APK link from chrome and away it went downloading. My tablet asked which of 3 programs to use; I again chose Chrome for this. I dismissed the warning about dangerous file types.
  3. After it downloads, I used the EF file browser to locate the downloads directory. Once there, I tapped the APK file. I ignored the warnings. It took me to my security settings and I checked the Unknown sources option. It then asked if I wanted to install this app and I tapped on install.
  4. Shazaam, it was installed, with a shortcut in my apps.
  5. I then launched it and found using pwd and some cd commands that I was in an empty directory, Android/data/tk.tcl.wish/files. However, env(HOME) points to /data/data/tk.tcl.wish/files so I’m not sure what’s up here.

I hope this helps.

[VV] - 2015-03-09 23:27:22

Androwish is so cool. I make a podcast using my moto E and Androwish. It is in the blog here: http://wp.me/piMZI-49W

PZ - 2015-04-26

It would be nice to have a 'AndroWish:How to make a good looking apps' or 'AndroWish:How to make a native looking apps' page. Do you have any experience?