I am running Ubuntu 10.10, and I installed Python 3.2 today. The system is already running Python 2.6.
I typed idle3.2 in the terminal and it gave me:
IDLE can't import Tkinter. Your Python may not be configured for Tk.
So I searched on Stack Overflow (and in some other places) for a solution, I installed python-tk
, I rechecked that I have tclsh
on the system, but I still can't manage to open idle3.2
.
Any input would be appreciated.
Using import tkinter as tk It comes with all the modules defined in tkinter. However, to save the major typing efforts, we import the tkinter library with some acronym further that can be used to create an instance of widgets. Thus, the application structures become more aesthetical by using the import tkinter as tk.
Tkinter is a Python package which comes with many functions and methods that can be used to create an application. In order to create a tkinter application, we generally create an instance of tkinter frame, i.e., Tk(). It helps to display the root window and manages all the other components of the tkinter application.
Tkinter is a Python binding to the Tk GUI toolkit. It is the standard Python interface to the Tk GUI toolkit, and is Python's de facto standard GUI. Tkinter is included with standard Linux, Microsoft Windows and macOS installs of Python. The name Tkinter comes from Tk interface.
On OSX, this can be resolved with macports by installing the python tkinter package for your python version. In my case, with python 2.7, I ran on the terminal:
sudo port install py27-tkinter
change the "27" to your python version number.
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