[Tutor] Config options on Tkinter Label Widget
Sheila King
sheila@thinkspot.net
Wed, 04 Jul 2001 17:55:25 -0700
I'm trying my hand at a bit of Tkinter programming. I must say, the
discussion in Mark Lutz' Programming Python, 2nd ed, is really
excellent.
Anyhow, I liked the suggestion in Chun's Core Python Programming for one
of the exercises: "Label and Entry Widgets and Python I/O: Create a GUI
application that provides and Entry field where the suer can provide the
name of a text file. Open the file and read it, displaying its contents
in a Label."
So, I'm just starting out on the exercise, and I decided to mess around
a bit with the look and feel of the application. (I've also snagged a
local copy of Lundh's Tkinter reference and the Tkinter Life
Preserver...so I think I have ample reference material.)
So, here is my code so far:
--------------------------------------------------------------
from Tkinter import *
root = Tk()
Directions = Label(root, text ='Enter name of File to Open:')
Directions.config(anchor=W)
inputBox = Entry(root, width=80)
Directions.pack()
inputBox.pack()
mainloop()
--------------------------------------------------------------
Now, notice the line where I am trying to configure on Directions the
positioning of the text in the label:
Directions.config(anchor=W)
>From reading Lundh's reference, I thought that this would position the
text all the way to the left of the label.
However, it remains centered.
Why isn't it moving to the left? What do I need to do to get that
effect?
Thanks,
--
Sheila King
http://www.thinkspot.net/sheila/
http://www.k12groups.org/