1

Topic: Help running tkinter

It seems to be part of python but when I run "python -m tkinter" I get this error:

$ python -m tkinter
Traceback (most recent call last):
  File "/usr/lib/python3.8/runpy.py", line 185, in _run_module_as_main
    mod_name, mod_spec, code = _get_module_details(mod_name, _Error)
  File "/usr/lib/python3.8/runpy.py", line 144, in _get_module_details
    return _get_module_details(pkg_main_name, error)
  File "/usr/lib/python3.8/runpy.py", line 111, in _get_module_details
    __import__(pkg_name)
  File "/usr/lib/python3.8/tkinter/__init__.py", line 36, in <module>
    import _tkinter # If this fails your Python may not be configured for Tk
ModuleNotFoundError: No module named '_tkinter'

I have tk installed. Do I need to install anything else?

2

Re: Help running tkinter

Hey,

for the moment the current python-version has no tk-support implemented. We know about this for sure and I have tried to review this some time ago. But until now the focus was more into have the packages running stable and rock-solid. If you like to support me here within to make that possible for version 0.4.5? I would be happy to include this.

What this means: I would add tk-support with the next builds, but this needs testing for sure.

Human being in favor with clear principles and so also for freedom in soft- and hardware!

Certainly anyone who has the power to make you believe absurdities has the power to make you commit injustices: For a life of every being full with peace and kindness, including diversity and freedom. Capitalism is destroying our minds, the planet itself and the universe in the end!

3 (edited by aloniv 2024-04-17 15:34:51)

Re: Help running tkinter

Thanks for the reply - I thought I was missing some package but couldn't figure out which one.
Anyway, I only needed tk support in python because I was trying to run a kakuro game that required it which can be found on this website (and a PKGBUILD is available in the AUR):
http://pzl.org.uk/
I found another kakuro game, one which depends on Qt4 libraries, and I managed to compile it successfully:
https://kakuro.mk2k.net/index.html

4

Re: Help running tkinter

You can use for the moment the draft I have in the sources local and perhaps give feedback about its integration:

# Maintainer (Arch): Angel Velasquez <angvp@archlinux.org>
# Maintainer (Arch): Felix Yan <felixonmars@archlinux.org>
# Contributor (Arch): Stéphane Gaudreault <stephane@archlinux.org>
# Contributor (Arch): Allan McRae <allan@archlinux.org>
# Contributor (Arch): Jason Chu <jason@archlinux.org>
# Maintainer: André Silva <emulatorman@hyperbola.info>
# Contributor: Tobias Dausend <throgh@hyperbola.info>

pkgname=python
pkgver=3.8.5
_debver=$pkgver
_debrel=1
pkgrel=3
_pybasever=${pkgver%.*}
pkgdesc="Next generation of the python high-level scripting language"
arch=('i686' 'x86_64')
license=('Python')
url="https://www.python.org/"
depends=('expat' 'bzip2' 'gdbm' 'libressl' 'libffi' 'libxcrypt' 'zlib')
makedepends=('tk' 'sqlite' 'mpdecimal' 'quilt')
optdepends=('sqlite: for a default database integration'
            'mpdecimal: for decimal'
            'xz: for lzma'
            'tk: for tkinter')
provides=('python3')
replaces=('python3')
source=("https://www.python.org/ftp/python/${pkgver%rc*}/Python-${pkgver}.tar.xz"{,.asc}
        "https://repo.hyperbola.info:50000/sources/${pkgname}/python3.8_$_debver-$_debrel.debian.tar.xz"{,.sig})
sha512sums=('460cee65d7df7150694590575502d7f22e548ebfc99c8f8b363eef8bf30ee72e58d8ffacb1d607824f877f880eb9fd6775a508388029583e1e1df3380f3f9587'
            'SKIP'
            '9540848f66c03c0e6ca289ca5b4aeefc41e04b199a3e073509eb23d8095814a39aa3f835d4e495656ff6fe3a6f942c44755d2d34fcd77f002a2bc13aac239125'
            'SKIP')
validpgpkeys=('0D96DF4D4110E5C43FBFB17F2D347EA6AA65421D'  # Ned Deily (Python release signing key) <nad@python.org>
              'E3FF2839C048B25C084DEBE9B26995E310250568'  # Łukasz Langa (GPG langa.pl) <lukasz@langa.pl>
              'C92BAA713B8D53D3CAE63FC9E6974752F9704456') # André Silva

prepare() {
  cd Python-${pkgver}

  if [[ ${pkgver%.*} = ${_debver%.*} ]]; then
    # Debian patches
    export QUILT_PATCHES=debian/patches
    export QUILT_REFRESH_ARGS='-p ab --no-timestamps --no-index'
    export QUILT_DIFF_ARGS='--no-timestamps'

    mv "$srcdir"/debian .

    # Doesn't apply
    rm -v debian/patches/arm-alignment.diff || true
    rm -v debian/patches/bdist-wininst-notfound.diff || true
    rm -v debian/patches/ctypes-arm.diff || true
    rm -v debian/patches/deb-locations.diff || true
    rm -v debian/patches/deb-setup.diff || true
    rm -v debian/patches/distutils-install-layout.diff || true
    rm -v debian/patches/distutils-link.diff || true
    rm -v debian/patches/distutils-sysconfig.diff || true
    rm -v debian/patches/doc-build-texinfo.diff || true
    rm -v debian/patches/ensurepip-disabled.diff || true
    rm -v debian/patches/ensurepip-wheels.diff || true
    rm -v debian/patches/ext-no-libpython-link.diff || true
    rm -v debian/patches/gdbm-import.diff || true
    rm -v debian/patches/git-updates.diff || true
    rm -v debian/patches/hurd_kfreebsd_thread_native_id.diff || true
    rm -v debian/patches/langpack-gettext.diff || true
    rm -v debian/patches/lib-argparse.diff || true
    rm -v debian/patches/lib2to3-no-pickled-grammar.diff || true
    rm -v debian/patches/local-doc-references.diff || true
    rm -v debian/patches/multiarch-extname.diff || true
    rm -v debian/patches/multiarch.diff || true
    rm -v debian/patches/pydoc-use-pager.diff || true
    rm -v debian/patches/sysconfig-debian-schemes.diff || true
    rm -v debian/patches/sysconfigdata-name.diff || true
    rm -v debian/patches/tkinter-import.diff || true

    quilt push -av
  fi

  # FS#23997
  sed -i -e "s|^#.* /usr/local/bin/python|#!/usr/bin/python|" Lib/cgi.py

  # Ensure that we are using the system copy of various libraries (expat, libffi, and libmpdec),
  # rather than copies shipped in the tarball
  rm -r Modules/expat
  rm -r Modules/_ctypes/{darwin,libffi}*
  rm -r Modules/_decimal/libmpdec
}

build() {
  cd Python-${pkgver}

  # Disable bundled pip & setuptools
  ./configure --prefix=/usr \
              --enable-shared \
              --with-computed-gotos \
              --enable-optimizations \
              --with-lto \
              --enable-ipv6 \
              --with-system-expat \
              --with-dbmliborder=gdbm:ndbm \
              --with-system-ffi \
              --with-system-libmpdec \
              --enable-loadable-sqlite-extensions \
              --without-ensurepip
}

package() {
  cd Python-${pkgver}

  # Hack to avoid building again
  sed -i 's/^all:.*$/all: build_all/' Makefile

  make DESTDIR="${pkgdir}" EXTRA_CFLAGS="$CFLAGS" install

  # Why are these not done by default...
  ln -s python3               "${pkgdir}"/usr/bin/python
  ln -s python3-config        "${pkgdir}"/usr/bin/python-config
  ln -s idle3                 "${pkgdir}"/usr/bin/idle
  ln -s pydoc3                "${pkgdir}"/usr/bin/pydoc
  ln -s python${_pybasever}.1 "${pkgdir}"/usr/share/man/man1/python.1

  # some useful "stuff" FS#46146
  install -dm755 "${pkgdir}"/usr/lib/python${_pybasever}/Tools/{i18n,scripts}
  install -m755 Tools/i18n/{msgfmt,pygettext}.py "${pkgdir}"/usr/lib/python${_pybasever}/Tools/i18n/
  install -m755 Tools/scripts/{README,*py} "${pkgdir}"/usr/lib/python${_pybasever}/Tools/scripts/

  # License
  install -Dm644 LICENSE "${pkgdir}/usr/share/licenses/${pkgname}/LICENSE"
}
Human being in favor with clear principles and so also for freedom in soft- and hardware!

Certainly anyone who has the power to make you believe absurdities has the power to make you commit injustices: For a life of every being full with peace and kindness, including diversity and freedom. Capitalism is destroying our minds, the planet itself and the universe in the end!

5

Re: Help running tkinter

Sidenote: You need for sure add the PGP-keys before compilation. Like this ...

gpg --keyserver keyserver.ubuntu.com --recv-key 0D96DF4D4110E5C43FBFB17F2D347EA6AA65421D
gpg --keyserver keyserver.ubuntu.com --recv-key E3FF2839C048B25C084DEBE9B26995E310250568
gpg --keyserver keyserver.ubuntu.com --recv-key C92BAA713B8D53D3CAE63FC9E6974752F9704456
Human being in favor with clear principles and so also for freedom in soft- and hardware!

Certainly anyone who has the power to make you believe absurdities has the power to make you commit injustices: For a life of every being full with peace and kindness, including diversity and freedom. Capitalism is destroying our minds, the planet itself and the universe in the end!

6

Re: Help running tkinter

The game works now with the updated python! Many thanks.

7

Re: Help running tkinter

Perfect: The package will be updated that way. Thanks for the feedback. smile

Human being in favor with clear principles and so also for freedom in soft- and hardware!

Certainly anyone who has the power to make you believe absurdities has the power to make you commit injustices: For a life of every being full with peace and kindness, including diversity and freedom. Capitalism is destroying our minds, the planet itself and the universe in the end!