0

I'm using tkinter to build gui with my mac.normally I'm using python IDLE to run and test the code. I created a new file with .py extension and run it. it works properly. this is the code.

from tkinter import *

mywin  = Tk();
mywin.title("window for mac")

This works fine

Then I tried to run the file using terminal and tried to launch the file with python launcher.at that time it gives following error

  File "check.py", line 1, in <module>
    from tkinter import *
    ImportError: No module named tkinter

my python version is Python 2.7.10. some says it is corruption on python. I tried to install python with home-brew also.but didn't get any result.

6
  • Maybe MAC used python version 2.X and idle run with 3.X. Try on terminal python3 blahblah.py Commented Jul 12, 2016 at 6:14
  • what can I do to get both for same version Commented Jul 12, 2016 at 6:47
  • @dsgdfg I tried with your answer in the comment, it didn't give any error.code execute but didn't give the window Commented Jul 12, 2016 at 6:51
  • No module named tkinter is python2.X error ! No module named Tkinter is python3.X error. Are you sure ? Commented Jul 12, 2016 at 6:52
  • On terminal can't display gui without any 'mainloop' ! Commented Jul 12, 2016 at 6:54

1 Answer 1

2

Idle and Terminal python version are different ! Need using same version of Python.

No module named tkinter is python2.X error ! No module named Tkinter is python3.X error.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.