How do you use the widgets in tkinter.ttk if you want to "import tkinter as tk"?

John Salerno johnjsal at gmail.com
Sat Mar 3 02:48:53 CET 2012


According to the Python docs, the way to use tkinter.ttk is this:

from tkinter import *
from tkinter.ttk import *

But what if I don't like this import method and prefer to do:

import tkinter as tk

How then do I utilize tkinter.ttk using the same name? Or is that not possible? Will I have to use to separate names, like this:

import tkinter as tk
import tkinter.ttk as ttk

Is that the only way?



More information about the Python-list mailing list