I had been using Python2.7 on Windows 10 (64-bit). I recently decided to upgrade to 3.0 to update some legacy scripts.
I uninstalled Python27, and installed Python30 (I know I could supposedly run them concurrently on the same system, but I chose not to use that as a crutch) and updated the Windows %PATH%
My old scripts used ttk (import ttk).
I updated to use "from tkinter import ttk", but now I'm getting "cannot import name ttk". I'm assuming it's still somehow trying to link to the 2.7 Tkinter that no longer exists (and didn't contain ttk as a submodule since it was 2.7).
How can I get ttk to link correctly under Python3 after having used 2.7?
Related
I just downloaded Pycharm because Spyder on Anaconda wasn't working anymore on my Mac. I am trying use Tkinter and have tried to run code using both
from tkinter import *
and
import tkinter as tk
The second is from my python class. Both times it returns
ImportError: No module named tkinter
I have tried to search for "tkinter" on Python Interpreter but there's no solid "tkinter." Only others like tkinter.math. Please help.
Tkinter would not be visible on Python Interpreter since it is a part of standard Python installation, the only additional modules or packages which user downloads are visible in Settings. Since, Spyder on your PC is not working as well, make sure python is installed properly and is configured correctly with path details properly set up.
I think you should check the interpreter of PyCharm.
Or Reinstall the python package and make a virtual environment.
hey i'am new in programming ..
I am doing a mini project in python in pycharm..
I am getting an error which says Tkinter module not installed..
plzz anybody can help..!!
in case of Python3.6, tkinter is a part of the standard library available from when you install your python. However if you want to know if tkinter is installed just import it in the python console
import tkinter
if you didn't see any errors you are good to go.
I'll preface this by saying that I am aware that on 2.7 it should be:
import Tkinter
However, for whatever reason on my desktop running xenial and
python --version
returning:
python 2.7.12
I have had no trouble throughout the development of an application on my system importing tkinter with
import tkinter
I am wholly confused because as I went to work on a different machine I attempted to run my code only to find out I should have been using
import Tkinter
Which executes fine on the second machine. However,
import tkinter
returns that there is no module named tkinter.
Does anybody know why this is happening?
You must have installed the six module at some point. It includes a dummy tkinter that allows python3 style tkinter imports in python2.
Does anyone happen to know how I can install tkMessageBox on Python2.7? I'm trying to run some Tkinter scripts that I've found, and I need the tkMessageBox to do so. I tried "pip install tkMessageBox" and got a message that said no package by that name could be found. I also tried looking on Christoph Gohlke's site for an installer, but no luck. I've read that tkMessageBox has changed names in Python3.x--can I pip install it by using a different name? Any help others can offer would be most appreciated. (In case it matters, I'm working in Windows 8.)
It comes with Tkinter, it's not a separate package. If you have tkinter, you have tkmessagebox. However, it has been renamed in python 3
python 2.x:
import Tkinter
import tkMessageBox
python 3.x:
from tkinter import messagebox as tkMessageBox
Has anyone else had this problem? I have re-installed twice with the same result. The pre-install of 2.6 on the Mac had a lib-tk folder with the correct modules. Nothing like this is being created for 3.1. There is a Tkinter folder but it contains only a few obscure modules. Importing _tkinter and tkinter works but not Tkinter and all of the example programs fail.
Tkinter was substantially refactored in Python 3 from a set of modules into packages. Tkinter is now tkinter and the lib-tk folder no longer exists. At least some of the example tkinter programs included in the OS X 3.1 distribution work if you ensure they are being launched under Python 3 and not Python 2. See the Python 3.1 library reference.