Upload tkinter/TKINTER_USER_GUIDE.txt with huggingface_hub
Browse files
tkinter/TKINTER_USER_GUIDE.txt
ADDED
|
@@ -0,0 +1,87 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
================================================================================
|
| 2 |
+
TKINTER - USER GUIDE (Android Python STB) - Generated by RIMI
|
| 3 |
+
================================================================================
|
| 4 |
+
|
| 5 |
+
WHAT THIS IS
|
| 6 |
+
------------
|
| 7 |
+
tkinter 8.6.14 - the standard Python GUI toolkit (Tcl/Tk) for Android.
|
| 8 |
+
Each wheel is fully self-contained: the Tcl 8.6.14 + Tk 8.6.14 shared
|
| 9 |
+
libraries (the whole X11 client stack - Xau, Xdmcp, xcb, X11, Xext,
|
| 10 |
+
Xrender, Xss, Xft, fontconfig, expat, freetype, libpng - is statically
|
| 11 |
+
merged INSIDE libtk8.6.so), the _tkinter C extension for CPython 3.12,
|
| 12 |
+
the Tcl/Tk script libraries (incl. tzdata for the `clock` command), a
|
| 13 |
+
pruned X11 locale set, and a 2-font DejaVu subset with its own
|
| 14 |
+
fonts.conf. No other package is required (no dependencies).
|
| 15 |
+
|
| 16 |
+
tkinter-8.6.14-cp312-cp312-android_24_arm64_v8a.whl (real ARM64 phones)
|
| 17 |
+
tkinter-8.6.14-cp312-cp312-android_24_x86_64.whl (x86_64 emulators)
|
| 18 |
+
|
| 19 |
+
REQUIREMENT: COMPANION X SERVER
|
| 20 |
+
--------------------------------
|
| 21 |
+
Android has no X server of its own. Install the Termux:X11 companion app
|
| 22 |
+
and start it BEFORE creating any window. This wheel talks to it over TCP:
|
| 23 |
+
|
| 24 |
+
import os
|
| 25 |
+
os.environ["DISPLAY"] = "127.0.0.1:0" # Termux:X11 default TCP display
|
| 26 |
+
# os.environ["XAUTHORITY"] = ... # only if you enabled X auth
|
| 27 |
+
|
| 28 |
+
Unix-socket DISPLAY values (":0") can NOT work across Android app
|
| 29 |
+
sandboxes - always use the TCP form above.
|
| 30 |
+
|
| 31 |
+
INSTALL
|
| 32 |
+
-------
|
| 33 |
+
1. Install the wheel matching your device architecture via PipManager.
|
| 34 |
+
2. No extra packages, no TCL_LIBRARY/TK_LIBRARY setup: importing the
|
| 35 |
+
bootstrap module below wires everything to the bundled files.
|
| 36 |
+
|
| 37 |
+
QUICK START
|
| 38 |
+
-----------
|
| 39 |
+
import _tk_android # MUST come first: preloads libtcl/libtk,
|
| 40 |
+
# sets TCL_LIBRARY/TK_LIBRARY/XLOCALEDIR/
|
| 41 |
+
# FONTCONFIG_FILE, writes fonts/fonts.conf
|
| 42 |
+
import tkinter
|
| 43 |
+
from tkinter import ttk
|
| 44 |
+
|
| 45 |
+
root = tkinter.Tk() # needs Termux:X11 running + DISPLAY set
|
| 46 |
+
root.title("Hello Android")
|
| 47 |
+
ttk.Label(root, text="DejaVu via bundled fonts.conf").pack()
|
| 48 |
+
ttk.Button(root, text="Quit", command=root.destroy).pack()
|
| 49 |
+
root.mainloop()
|
| 50 |
+
|
| 51 |
+
HEADLESS Tcl (no display needed):
|
| 52 |
+
import _tk_android, _tkinter
|
| 53 |
+
t = _tkinter.create(None, None, "Tk", 0, 0, 0, 0, None) # wantTk=0
|
| 54 |
+
t.call("expr", "6*7") # -> '42'
|
| 55 |
+
t.call("info", "patchlevel") # -> '8.6.14'
|
| 56 |
+
|
| 57 |
+
API GOTCHAS
|
| 58 |
+
-----------
|
| 59 |
+
- `import _tk_android` first, in EVERY script (it only uses setdefault:
|
| 60 |
+
values you exported yourself still win).
|
| 61 |
+
- This wheel ships NO `tkinter/` package dir, so the app's stdlib
|
| 62 |
+
`tkinter/*.py` is always used; only the `_tkinter` extension (which the
|
| 63 |
+
app does not ship) comes from the wheel.
|
| 64 |
+
- Fonts: only DejaVuSans + DejaVuSans-Bold are bundled (1.4 MB). The
|
| 65 |
+
generated fonts.conf also lists /system/fonts as fallback, so device
|
| 66 |
+
Droid fonts remain reachable by family name.
|
| 67 |
+
- X11 locale data is pruned to C + en_US.UTF-8 + iso8859-1. Non-UTF8
|
| 68 |
+
locales and Compose tables for other languages are NOT included.
|
| 69 |
+
- `t.call("clock", ...)` timezones work: tzdata (609 files) is vendored.
|
| 70 |
+
- Tested surface (see Test_Tkinter.py, 10 checks, import-level only):
|
| 71 |
+
bootstrap import, env wiring, fonts.conf generation, bundled libs
|
| 72 |
+
present, _tkinter import, headless Tcl interp, patchlevel 8.6.14,
|
| 73 |
+
expr arithmetic, clock+tzdata, stdlib tkinter unshadowed. The GUI
|
| 74 |
+
window test is a later device phase (needs Termux:X11 on device).
|
| 75 |
+
|
| 76 |
+
VERSIONS INSIDE
|
| 77 |
+
---------------
|
| 78 |
+
Tcl/Tk 8.6.14 | xorgproto 2025.1 | xtrans 1.6.0 | xcb-proto 1.17.0 |
|
| 79 |
+
libXau 1.0.12 | libXdmcp 1.1.5 | libxcb 1.17.0 | libX11 1.8.13 |
|
| 80 |
+
libXext 1.3.7 | libXrender 0.9.12 | libXss 1.2.5 | libXft 2.3.9 |
|
| 81 |
+
libpng 1.6.58 | expat 2.8.4 | freetype 2.14.3 | fontconfig 2.18.3 |
|
| 82 |
+
DejaVu 2.37 (Sans + Sans-Bold) | CPython 3.12 | API 24+.
|
| 83 |
+
All 12 Termux Android patches applied; Xft enabled; PythonSTB-RIMI-Build.
|
| 84 |
+
|
| 85 |
+
================================================================================
|
| 86 |
+
Generated by RIMI
|
| 87 |
+
================================================================================
|