1{
2 lib,
3 stdenv,
4 buildPythonPackage,
5 python,
6 py,
7 isPyPy,
8}:
9
10buildPythonPackage {
11 pname = "tkinter";
12 version = python.version;
13 src = py;
14 format = "other";
15
16 disabled = isPyPy;
17
18 installPhase =
19 ''
20 # Move the tkinter module
21 mkdir -p $out/${py.sitePackages}
22 mv lib/${py.libPrefix}/lib-dynload/_tkinter* $out/${py.sitePackages}/
23 ''
24 + lib.optionalString (!stdenv.isDarwin) ''
25 # Update the rpath to point to python without x11Support
26 old_rpath=$(patchelf --print-rpath $out/${py.sitePackages}/_tkinter*)
27 new_rpath=$(sed "s#${py}#${python}#g" <<< "$old_rpath" )
28 patchelf --set-rpath $new_rpath $out/${py.sitePackages}/_tkinter*
29 '';
30
31 meta = py.meta // {
32 # Based on first sentence from https://docs.python.org/3/library/tkinter.html
33 description = "The standard Python interface to the Tcl/Tk GUI toolkit";
34 longDescription = ''
35 The tkinter package (“Tk interface”) is the standard Python interface to
36 the Tcl/Tk GUI toolkit. Both Tk and tkinter are available on most Unix
37 platforms, including macOS, as well as on Windows systems.
38
39 Running python -m tkinter from the command line should open a window
40 demonstrating a simple Tk interface, letting you know that tkinter is
41 properly installed on your system, and also showing what version of
42 Tcl/Tk is installed, so you can read the Tcl/Tk documentation specific to
43 that version.
44
45 Tkinter supports a range of Tcl/Tk versions, built either with or without
46 thread support. The official Python binary release bundles Tcl/Tk 8.6
47 threaded. See the source code for the _tkinter module for more
48 information about supported versions.
49
50 Tkinter is not a thin wrapper, but adds a fair amount of its own logic to
51 make the experience more pythonic. This documentation will concentrate on
52 these additions and changes, and refer to the official Tcl/Tk
53 documentation for details that are unchanged.
54 '';
55 };
56}