Cannot import ttk in python tkinter

Viewed 386

I am trying to import ttk from tkinter. I am following instructions from this website:

I am using Spyder on mac with OS Mojave, on Spyder, python version is 3.8.6 (according to sys.version)

My code is:

import tkinter as tk
from tkinter import ttk

I am getting the following error message:

runfile('/Users/Tom/untitled0.py', wdir='/Users/Tom')
Traceback (most recent call last):

  File "/Users/Tom/untitled0.py", line 3, in <module>
    from tkinter import ttk

ImportError: cannot import name 'ttk' from 'tkinter' (/Applications/Spyder.app/Contents/Resources/lib/python38.zip/tkinter/__init__.pyc)
1 Answers

(Spyder maintainer here) The problem happened because Tk was not included in our Mac application. However, that's fixed now in our 4.2.5 or any 5 versions.

Related