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