Title: Signature.html
Nothing like a good example. anchors away. It's where you put it. anchor=CENTER.

See <http://www.java2s.com/Code/Python/GUI-Tk/Usingthegridgeometrymanager.htm> for more.

from Tkinter import *

class App:
    def __init__(self, master):
        master.geometry("300x200")
        fm = Frame(master)
        Button(fm, text='side=TOP, anchor=NW').pack(side=TOP, anchor=NW, expand=YES)
        Button(fm, text='side=TOP, anchor=W').pack(side=TOP, anchor=W, fill=X, expand=YES)
        Button(fm, text='side=TOP, anchor=E').pack(side=TOP, anchor=E, expand=YES)
        fm.pack(fill=BOTH, expand=YES)

        
root = Tk()
root.option_add('*font', ('verdana', 12'bold'))
root.title("Pack - Example 11")
display = App(root)
root.mainloop()



Wayne Watson wrote:
I'm prototyping a dialog with about 10 rows of 4 columns of widgets. Most rows are like:
        Label, Entry, Label, Entry
A couple only have Label, Entry.

I'm using Grid. It's gone pretty well, but I'd like to make it "prettier". For example, a row with latitude and longitude gets spread across the dialog, whereas, they should be closer together. However, at the moment, I'm trying
 to build a title across row 8. I want some centering of the text, but the methods and options defy my attempts. Comments?

                ...
        self.title("Enter Site Data")
        Label(master, text='Latitude:').grid(row=0, sticky=W)
        self.lat = Entry(master, width=12)
        self.lat.grid(row=0, column=1)
       
        Label(master, text='Longitude:').grid(row=0, column=2)
        self.long = Entry(master, width=12)
        self.long.grid(row=0, column=3)
          ...
        mask_value="40"
        Label(master, text='Flat Mask Value:').grid(row=6, sticky=W)
        self.flat_value = Entry(master, width=7)
        self.flat_value.grid(row=6, column=1)
        self.flat_value.insert(4,mask_value)
       
        Label(master, text='Mask File Name:').grid(row=7, sticky=W)
        self.mask_name = Entry(master, width=40)
        self.mask_name.grid(row=7, column=1)

        #title=Label(master, text="This is a Title").grid(row=8,column=0, column(anchor=CENTER), columnspan=3)
        title=Label(master, text="This is a Title").grid(row=8, column=0, columnspan=3).columnconfigure(0,anchor=CENTER)
        #title.configure(anchor=CENTER)
          ...
--

           Wayne Watson (Watson Adventures, Prop., Nevada City, CA)

             (121.01 Deg. W, 39.26 Deg. N) GMT-8 hr std. time)


                Life is one damn thing after another."
                     -- Mark Twain 
  

_______________________________________________ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

--
Signature.html
           Wayne Watson (Watson Adventures, Prop., Nevada City, CA)

             (121.01 Deg. W, 39.26 Deg. N) GMT-8 hr std. time)


                Life is one damn thing after another."
                     -- Mark Twain 
_______________________________________________
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor

Reply via email to