I have tried to staring the application in VSCODE by Python3.
This is the code:
from tkinter import *
window = Tk()
window.mainloop()
only 3 lines :))
, but when I'm trying to execute the file in terminal it will give me an error, which you can see below.
arash@Arash-MacBook-Pro tkinter % python3 main.py
macOS 11 or later required !
zsh: abort ------ python3 main.py
arash@Arash-MacBook-Pro tkinter %
My Mac worked on "Big Sur" and has Python3.9.
In conclusion, if the error no module named tkinter raises, it probably means you are using python 2. Firstly, you can get around the problem by upgrading to python 3. Additionally, you can rename your import to Tkinter , which is how the module was named in python 2, just if upgrading is not an option.
DEPRECATION WARNING: The system version of Tk is deprecated and may be removed in a future release. Please don't rely on it.
Tkinter is the de facto way in Python to create Graphical User interfaces (GUIs) and is included in all standard Python Distributions. In fact, it's the only framework built into the Python standard library.
The only difference between Tkinter and tkinter is that Tkinter was initially used with Python 2 and tkinter is used for working with Python 3 or later versions.
This is an issue in the way brew
installs Python (source). If you install Python directly via the official installer here then tkinter
should work as expected.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With