When I type from Tkinter import ttk
it says that there is no module named ttk
, and also on many websites online the t
in tkinter
is always lowercase, but when I type tkinter
in Python it throws an error. Why is that?
There is nothing wrong with the case. As other answer specified - its Tkinter
in Python 2.x and tkinter
in Python 3.x version.
In addition ttk
was a separate module in Python 2.x and its a submodule of Tkinter in Python 3.x
So in Python 2.x you would import ttk as
from Tkinter import *
import ttk
And in Python 3.x you would import ttk as
from tkinter import *
from tkinter.ttk import *
or
from tkinter import ttk
Tkinter
in python 2.6 is capitalized, in python 3 it is lowercase, tkinter
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