WelcomeWelcome | FAQFAQ | DownloadsDownloads | WikiWiki

Author Topic: How do I install tkinter?  (Read 1343 times)

Offline saladin

  • Jr. Member
  • **
  • Posts: 61
How do I install tkinter?
« on: January 16, 2023, 08:50:45 AM »
I'm using Pure 64, and I have Python 3.7.6 installed. tkinter is supposed to come installed with python by default, so I can't seem to install it via pip, but I'm also not seeing it in the TCZs. Am I missing something?

Online Rich

  • Administrator
  • Hero Member
  • *****
  • Posts: 11178
Re: How do I install tkinter?
« Reply #1 on: January 16, 2023, 10:17:24 AM »
Hi saladin
You did not bother to mention which version of Tinycore you are running. Searching
through the python .info files it appears you are referring to TC10.

... tkinter is supposed to come installed with python by default, ... but I'm also not seeing it in the TCZs. ...
Is this (TK interface to the tcl tool command language) what you are looking for:
http://tinycorelinux.net/10.x/x86_64/tcz/tk.tcz.info
http://tinycorelinux.net/10.x/x86_64/tcz/tk8.6.tcz.info

Offline saladin

  • Jr. Member
  • **
  • Posts: 61
Re: How do I install tkinter?
« Reply #2 on: January 16, 2023, 10:24:55 AM »
I installed both of those, but when I run

Code: [Select]
python3 -m tkinter
it tells me "No module named '_tkinter'"

When I try to import tkinter into a python script, I'm getting the same message.

If this is tkinter, maybe it's installing for Python 2 instead of Python 3?

Online Rich

  • Administrator
  • Hero Member
  • *****
  • Posts: 11178
Re: How do I install tkinter?
« Reply #3 on: January 16, 2023, 10:47:45 AM »
Hi saladin
It looks like you might need something called  python3-tk  which is not
in the repository and supposedly pip won't work.
Found here:
https://askubuntu.com/questions/815874/importerror-no-named-tkinter-please-install-the-python3-tk-package
https://stackoverflow.com/questions/6084416/tkinter-module-not-found-on-ubuntu

This may be of some help:
https://stackoverflow.com/questions/25905540/importerror-no-module-named-tkinter

I also saw some mentions of  Tkinter  was renamed to tkinter.

Online Rich

  • Administrator
  • Hero Member
  • *****
  • Posts: 11178
Re: How do I install tkinter?
« Reply #4 on: January 16, 2023, 11:06:59 AM »
Hi saladin
Did you try:
Code: [Select]
pip install tk

Offline saladin

  • Jr. Member
  • **
  • Posts: 61
Re: How do I install tkinter?
« Reply #5 on: January 16, 2023, 11:29:28 AM »
I did try tk. It did successfully install something, but you're supposed to be able to verify a tkinter installation with

Code: [Select]
tkinter._test()
That gives me the error: "NameError: name 'tkinter' is not defined"

When I try

Code: [Select]
tk._test()
That gives me the error: "AttributeError: module 'tk' has no attribute '_test'".

If I run

Code: [Select]
dir(tk)
it's only giving me nine objects, and they don't look like what I should be getting with tkinter. I think this is a completely different module with a similar name.

I'm thinking I'll have to reinstall python from scratch.

Online Rich

  • Administrator
  • Hero Member
  • *****
  • Posts: 11178
Re: How do I install tkinter?
« Reply #6 on: January 16, 2023, 12:02:47 PM »
Hi saladin
The build script for python shows  tk-dev.tcz  geting loaded:
http://tinycorelinux.net/10.x/x86_64/tcz/src/python3.7/python3.7.tcz.build-dep
The python .list file shows some tkinter files included:
http://tinycorelinux.net/10.x/x86_64/tcz/python3.7.tcz.list

Offline Juanito

  • Administrator
  • Hero Member
  • *****
  • Posts: 14516
Re: How do I install tkinter?
« Reply #7 on: January 16, 2023, 07:33:52 PM »
Here’s how python3.6 was compiled: http://www.tinycorelinux.net/12.x/x86_64/tcz/src/python3.6/compile_python3.6

This works:
Code: [Select]
tce-load -i python3.6 tk8.6
python3.6m -m tkinter

..and brings up a gui box saying "click me".
« Last Edit: January 16, 2023, 09:16:49 PM by Juanito »

Offline saladin

  • Jr. Member
  • **
  • Posts: 61
Re: How do I install tkinter?
« Reply #8 on: January 17, 2023, 06:28:27 AM »
Ah yes, that works for me. Thank you!

I guess the problem was that I was using python 3.7.