[Tutor] Left Alignment -- Tkinter
Alan Gauld
alan.gauld at btinternet.com
Fri Mar 27 20:04:34 CET 2009
Try packing the frame to the left and set it to expand.
HTH, Going on vacation....
Bye
Alan G.
"Wayne Watson" <sierra_mtnview at sbcglobal.net> wrote in message
news:49CD0D40.5090508 at sbcglobal.net...
> Signature.htmlThe code below is clearly not shifting the contents of the
> frame to the left. It's supposed to look like
>
> Geographic Location
> Latitude BOX Longitude BOX
> OK Cancel
>
> but instead looks like:
> Geographic Location
> Latitude BOX Longitude BOX
> OK Cancel
>
> Where BOX is just a data entry field. I've deliberately made the label
> size big enough so as not to obscure what happens with default values. A
> 30x5 size. That is if I remove the size options, then it looks OK. I
> don't think it really gets shift to the left though even though it looks
> like it does. Comments?
>
> # Framing it
> from Tkinter import *
> from tkSimpleDialog import Dialog
> import tkSimpleDialog
> import tkMessageBox
>
> class DialogPrototype(Dialog):
>
> def body(self, master):
>
> # Frames
> fLocationTitle = Frame(master,) # fL... f for frame
> fLocationTitle.pack()
> fLocation=Frame(master)
> fLocation.pack()
> fCoords = Frame(fLocation) # lat/long coords in a frame
> fCoords.pack()
>
>
> self.title("Enter Site/Misc. Data")
>
> # Latitude and Longitude
>
> Label(fLocationTitle, text="Geographic
> Location").grid(row=0,column=0)
> #Label(fCoords, text='Latitude:').grid(row=0, sticky=W)
> self.lab=Label(fCoords, text='Latitude:',width=30, height=5)
> self.lab.grid(row=0, sticky=W)
> self.lat = Entry(fCoords, width=12)
> self.lat.grid(row=0, column=1)
>
> Label(fCoords, text='Longitude:').grid(row=0, column=2)
> self.long = Entry(fCoords, width=12)
> self.long.grid(row=0, column=3)
>
> return
>
> def apply(self):
> print "apply"
> print self.lat.get()
> print self.long.get()
>
> print "setting"
> lat=1.0
> long=0.0
>
> root = Tk()
> root.withdraw()
> DialogPrototype(root)
>
> --
>
> 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 at python.org
> http://mail.python.org/mailman/listinfo/tutor
>
More information about the Tutor
mailing list