Skip to content Skip to sidebar Skip to footer

Running Tkinter On Mac

I am an absolute newbie. I'm trying to make Python GUI for my school project so I decided to use Tkinter. When I try to import Tkinter it throws this message: >>> import t

Solution 1:

To check your python version, run this on terminal:

$ python --version

Check what python your machine is using. Run:

$ which python

If it's using python from Homebrew, it's probably using Python 2. If you installed python 3 manually, just install tKinter manually.

$ brew install python-tk

To run python 2 manually, run on terminal:

$ python <FILENAME>

If python 3, run:

$ python3 <FILENAME>

Solution 2:

https://stackoverflow.com/a/9883299/4678635 will help you.

In summary, you have to reinstall python for your computer bit system.

And below code strategy is also helpful to you.

try:    
    from Tkinter import * # for Python2except ImportError:
    from tkinter import * # for Python3

Solution 3:

TKinter is used for making GUI application so it not work in mac, Kivy framework is good for macos,window,linux and andorid also so use this only some information about kivy is thire = https://www.google.com/search?q=Kivy&oq=Kivy&aqs=chrome..69i57j35i39j0i67i433l2j0i67l2j0i20i263j0i67j0i67i433j0i67.1029j0j7&sourceid=chrome&ie=UTF-8 code = import TKinter print("hello") output hello

Post a Comment for "Running Tkinter On Mac"