[Tutor] Left Alignment -- Tkinter

Alan Gauld alan.gauld at btinternet.com
Wed Apr 1 23:03:32 CEST 2009


"W W" <srilyk at gmail.com> wrote

> Good news... I got it!
>
> Here's something that's often a good idea when debugging overlapping 
> layouts
> (especially when you didn't design the parent!) - use different 
> backgrounds!

Yes, or for Frames use a relief value to see where the frame bounds are.

> Here's my changes (also found here: http://rafb.net/p/clKroD65.html )

Here is my stripped down version that does what I think you want::

    def body(self, master):
        self.title("Enter Site/Misc. Data")

        # Heading
        fLocationTitle = Frame(master, height=7)
        fLocationTitle.pack()
        Label(fLocationTitle, text="Geographic Location").pack()

        # Latitude and Longitude
        fCoords = Frame(master)
        fCoords.pack()
        Label(fCoords, text='Latitude:').grid(row=0, column=0, padx=5)
        self.lat = Entry(fCoords, width=12)
        self.lat.grid(row=0, column=1, padx=5)

        Label(fCoords, text='Longitude:').grid(row=0, column=2, padx=5 )
        self.long = Entry(fCoords, width=12)
        self.long.grid(row=0, column=3, padx=5)


I removed quirte a lot of the redundant code that was cluttering things
up and moved the frames to beside the widgets that are contained
within them.

HTH,

Alan G.
Back from vacation...




More information about the Tutor mailing list