On 15/04/15 18:00, boB Stepp wrote:

import Tkinter as tk

Question: I have been using "from Tkinter import *" as suggested in
"Programming Python" by Lutz. He remarks that unlike other situations,
this is generally safe with Tkinter. Is there a benefit to doing the
import as you have?

Biggest benefit is if you ever move to Python 3 you cansimply change that line to

import tkinter as tk

and it carries on working (or at least until you hit some
of the other renamed modules!)

But also if you ever get to use Tix, because it is a
superset of Tkinter so you can just change to

import tix as tk

and it keeps working but you now have access to all the
Tix widgets too.

--
Alan G
Author of the Learn to Program web site
http://www.alan-g.me.uk/
http://www.amazon.com/author/alan_gauld
Follow my photo-blog on Flickr at:
http://www.flickr.com/photos/alangauldphotos


_______________________________________________
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
https://mail.python.org/mailman/listinfo/tutor

Reply via email to