[Tutor] question about import statement

Alan Gauld alan.gauld at btinternet.com
Fri Aug 27 09:43:08 CEST 2010


"Bill Allen" <wallenpb at gmail.com> wrote

> *from tkinter import *
> from tkinter import ttk
>
> These two lines tell Python that our program needs two modules. The 
> first,
> "tkinter", is the standard binding to Tk, which when loaded also 
> causes the
> existing Tk library on your system to be loaded. The second, "ttk", 
> is
> Python's binding to the newer "themed widgets" that were added to Tk 
> in 8.5.

Yes, they are both modules so must both be imported. You could also 
do:

import tkinter as tk
import tkinter.ttk as ttk

which is the style I tend to use for my own code.

HTH,

Alan G 




More information about the Tutor mailing list