File size: 4,165 Bytes
a98d6ef
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
================================================================================
  TKINTER - USER GUIDE (Android Python STB) - Generated by RIMI
================================================================================

WHAT THIS IS
------------
tkinter 8.6.14 - the standard Python GUI toolkit (Tcl/Tk) for Android.
Each wheel is fully self-contained: the Tcl 8.6.14 + Tk 8.6.14 shared
libraries (the whole X11 client stack - Xau, Xdmcp, xcb, X11, Xext,
Xrender, Xss, Xft, fontconfig, expat, freetype, libpng - is statically
merged INSIDE libtk8.6.so), the _tkinter C extension for CPython 3.12,
the Tcl/Tk script libraries (incl. tzdata for the `clock` command), a
pruned X11 locale set, and a 2-font DejaVu subset with its own
fonts.conf. No other package is required (no dependencies).

  tkinter-8.6.14-cp312-cp312-android_24_arm64_v8a.whl   (real ARM64 phones)
  tkinter-8.6.14-cp312-cp312-android_24_x86_64.whl      (x86_64 emulators)

REQUIREMENT: COMPANION X SERVER
--------------------------------
Android has no X server of its own. Install the Termux:X11 companion app
and start it BEFORE creating any window. This wheel talks to it over TCP:

  import os
  os.environ["DISPLAY"] = "127.0.0.1:0"   # Termux:X11 default TCP display
  # os.environ["XAUTHORITY"] = ...         # only if you enabled X auth

Unix-socket DISPLAY values (":0") can NOT work across Android app
sandboxes - always use the TCP form above.

INSTALL
-------
1. Install the wheel matching your device architecture via PipManager.
2. No extra packages, no TCL_LIBRARY/TK_LIBRARY setup: importing the
   bootstrap module below wires everything to the bundled files.

QUICK START
-----------
  import _tk_android      # MUST come first: preloads libtcl/libtk,
                         # sets TCL_LIBRARY/TK_LIBRARY/XLOCALEDIR/
                         # FONTCONFIG_FILE, writes fonts/fonts.conf
  import tkinter
  from tkinter import ttk

  root = tkinter.Tk()    # needs Termux:X11 running + DISPLAY set
  root.title("Hello Android")
  ttk.Label(root, text="DejaVu via bundled fonts.conf").pack()
  ttk.Button(root, text="Quit", command=root.destroy).pack()
  root.mainloop()

HEADLESS Tcl (no display needed):
  import _tk_android, _tkinter
  t = _tkinter.create(None, None, "Tk", 0, 0, 0, 0, None)  # wantTk=0
  t.call("expr", "6*7")          # -> '42'
  t.call("info", "patchlevel")   # -> '8.6.14'

API GOTCHAS
-----------
- `import _tk_android` first, in EVERY script (it only uses setdefault:
  values you exported yourself still win).
- This wheel ships NO `tkinter/` package dir, so the app's stdlib
  `tkinter/*.py` is always used; only the `_tkinter` extension (which the
  app does not ship) comes from the wheel.
- Fonts: only DejaVuSans + DejaVuSans-Bold are bundled (1.4 MB). The
  generated fonts.conf also lists /system/fonts as fallback, so device
  Droid fonts remain reachable by family name.
- X11 locale data is pruned to C + en_US.UTF-8 + iso8859-1. Non-UTF8
  locales and Compose tables for other languages are NOT included.
- `t.call("clock", ...)` timezones work: tzdata (609 files) is vendored.
- Tested surface (see Test_Tkinter.py, 10 checks, import-level only):
  bootstrap import, env wiring, fonts.conf generation, bundled libs
  present, _tkinter import, headless Tcl interp, patchlevel 8.6.14,
  expr arithmetic, clock+tzdata, stdlib tkinter unshadowed. The GUI
  window test is a later device phase (needs Termux:X11 on device).

VERSIONS INSIDE
---------------
  Tcl/Tk 8.6.14 | xorgproto 2025.1 | xtrans 1.6.0 | xcb-proto 1.17.0 |
  libXau 1.0.12 | libXdmcp 1.1.5 | libxcb 1.17.0 | libX11 1.8.13 |
  libXext 1.3.7 | libXrender 0.9.12 | libXss 1.2.5 | libXft 2.3.9 |
  libpng 1.6.58 | expat 2.8.4 | freetype 2.14.3 | fontconfig 2.18.3 |
  DejaVu 2.37 (Sans + Sans-Bold) | CPython 3.12 | API 24+.
  All 12 Termux Android patches applied; Xft enabled; PythonSTB-RIMI-Build.

================================================================================
  Generated by RIMI
================================================================================