Author Topic: Python3 and TK  (Read 458 times)

michael

  • Newbie
  • *
  • Posts: 11
  • Karma: +0/-0
Python3 and TK
« on: Fri Feb 28 17:22:53 2020 »
Sorry to be back with another question already.  I am trying to use idle3 with Python3.  It needs tkinter, but I can not get python to recognize it.  Process I have used elsewhere:  Install TCL and TK.  Then re-buiild Python3.  On NuTyX TK does not seem to be included when Python3 is rebuilt, but no error message.  Or is there another issue or am I missing a step? Michael

Thierry

  • Administrator
  • Hero Member
  • *****
  • Posts: 580
  • Karma: +8/-0
  • Gender: Male
    • NuTyX distribution
Re: Python3 and TK
« Reply #1 on: Sat Feb 29 12:04:49 2020 »
Indeed, you didn't do anything wrong,
To ge the tk python module, I need to compile python with ... tk as a dependancie. I will try to make a python-tk package. Stay tune :D

Thierry

  • Administrator
  • Hero Member
  • *****
  • Posts: 580
  • Karma: +8/-0
  • Gender: Male
    • NuTyX distribution
Re: Python3 and TK
« Reply #2 on: Sat Feb 29 15:40:19 2020 »
It's a bit more tricky then expected, but faisable without messing up the rest of the python 3.8.2 package.

Do you really need this thinker module in which case I would need a example of Code using it so that I can test if it work as expected before Publishing the python-tkinter module.

Do you have such an exemple for my internal tests before ?

Thank you very much for your interests

michael

  • Newbie
  • *
  • Posts: 11
  • Karma: +0/-0
Re: Python3 and TK
« Reply #3 on: Sat Feb 29 17:43:48 2020 »
I am trying to run idle3 which is an IDE that comes with Python3.  I have idle3 and idle3.8 in /usr/bin.  (also idle, but it is for python2.7)  It I enter idle3 at the CLI, I get the error 'IDLE can't import Tkinter.  Your Python may not be configured for Tk.'  I don't really understand what code these scripts call, but on other systems they bring up a window with the IDE.  Another way I have verified that it was working on other systems, is to open python3 and type 'import tkinter' .  If there is no error message then from CLI 'idle3' also works.  Hope this helps.

Thierry

  • Administrator
  • Hero Member
  • *****
  • Posts: 580
  • Karma: +8/-0
  • Gender: Male
    • NuTyX distribution
Re: Python3 and TK
« Reply #4 on: Sat Feb 29 21:40:12 2020 »
I think I manage:

Just do:

Code: [Select]
sudo cards upgrade
sudo cards install python-tkinter

Hope it's ok


michael

  • Newbie
  • *
  • Posts: 11
  • Karma: +0/-0
Re: Python3 and TK
« Reply #5 on: Sat Feb 29 23:37:22 2020 »
Yes Thierry, works fine.  I guess python updated to 3.8.2.  Then I tried cards install python-tkinter.  Didn't write a bunch of files because they were already there, but 'cards install -f python-tkinter' installed the new ones and it works fine.  idle3 is there just like it is supposed to be.  Thank you very much.