Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
getting TKinter error on phyton app: tk USE flag set
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Other Things Gentoo
View previous topic :: View next topic  
Author Message
VanFanel
Apprentice
Apprentice


Joined: 19 Feb 2007
Posts: 161

PostPosted: Thu Jun 23, 2011 1:00 pm    Post subject: getting TKinter error on phyton app: tk USE flag set Reply with quote

Hello there

I'm trying to run a python app, with needs TKinter to create a gui, apparently.
The problem is that I have set the "tk" flag and re-emerged python. In fact, I have /usr/lib/python3.1/lib-dynload/_tkinter.so in my system, but I still get
Code:

ImportError: No module named TKinter


when trying to run an app.

I also ran python-updater after re-emerge, and even tried to run the *.py program with phyton3.1directly intead of the default one. Always the same error.


regards
Back to top
View user's profile Send private message
rh1
Guru
Guru


Joined: 10 Apr 2010
Posts: 501

PostPosted: Thu Jun 23, 2011 2:12 pm    Post subject: Reply with quote

I belive the module is now named 'tkinter' in Python 3.
Back to top
View user's profile Send private message
solamour
l33t
l33t


Joined: 21 Dec 2004
Posts: 698
Location: San Diego, CA

PostPosted: Fri Jul 27, 2012 3:58 am    Post subject: Reply with quote

I know it's an old thread, so I hope everyone has already figured it out by now. If you haven't, here is something that worked for me.

Code:
/etc/portage/package.use
    dev-lang/python tk


Code:
emerge -v --newuse python


Now, "import tkinter" (for Python 3.x) should work, but if it gives you "ImportError: No module named tkinter", make sure you are using the right Python version. For my case, I had v2.7, v3.1 (as default), and v3.2.

Code:
$ eselect python list
Available Python interpreters:
  [1]   python2.7
  [2]   python3.1 *
  [3]   python3.2


"tk" use flag was applied to v3.2 only, so when I ran python v3.1, it didn't know anything about tk use flag. I set the default Python to v3.2, and the problem went away.
__
sol
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Other Things Gentoo All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum