from tkinter import *
Loads everything from tkinter
module, and puts it in the global namespace.
import tkinter as tk
Loads everything from tkinter
module, and put it all in the tk
namespace. So Label
is now tk.Label
, and W
is tk.W
Your third option, which is better when you only need a few objects from the module, would be:
from tkinter import Label, Entry, Button, W, E, Tk
Etc. Again, better when you just need one or two. Not good for your situation. Just included for completeness.
Fortunately you only have one import *
or you'd have a much harder time determining which module everything came from!
Edit:
tkinter.W = 'w'
tkinter.E = 'e'
tkinter.S = 's'
tkinter.N = 'n'
They're just constants. You could pass the string value and it would work just as well.