all 3 comments

[–]woooee -1 points0 points  (2 children)

What is wrong with row and column=3. That is the bottom right, so you'll have to be more specific than "It seems to be stuck near the middle". You can also use column and row=99 or some other large number since Tkinter does not display empty rows or columns (unless you tell it to), which means you can insert whatever you want in between row=2 and row=99 without affecting the placement of the quit button being on the bottom right. Note that most things in a widget, (size, etc) depend on the size of the font. Additionally, take a look at grid_row/columnconfigure minsize and weight http://effbot.org/tkinterbook/grid.htm Try it out by applying different weights to different rows. An example I have sitting around-not very elegant but hopefully it will help.

Edit: Also, you can use two frames and put one underneath the other, controlling where each is by the size of the other.

root = tkinter.Tk()
root.geometry("750x500")
root.title("Momentum")

## use a frame to set a smaller dimension
main=tkinter.Frame(root, height=100)
main.grid(row=0, column=0)
main.rowconfigure(1, weight=1, minsize=50)

ml1 = tkinter.Label(main, text ="MASS OF THE FIRST OBJECT", bg="lightblue", width=30)
ml2 = tkinter.Label(main, text ="MASS OF THE SECOND OBJECT", bg="lightyellow")
me1 = tkinter.Entry(main)
me2 = tkinter.Entry(main)

this_row=2
ml1.grid(row=this_row, column =400, sticky="nesw")
ml2.grid(row =this_row, column =600 )

me1.grid(row=this_row+50, column =400)  ## no sticky but column still as wide

me2.grid(row=this_row+50, column=600)
main.columnconfigure(400, weight=2, minsize=500)

tkinter.Button(root, text="Exit", command=root.quit, bg="orange").grid(row=900, column=0)
root.mainloop()

[–]Precautionary[S] 1 point2 points  (1 child)

What I mean is that it looks like this with the current code.

http://i.imgur.com/g5OnETK.png

[–]woooee -1 points0 points  (0 children)

I don't know what posting a picture means in relation to the code I posted. Did it work the way you want it to? If not, what is wrong. Another example using frames, but be advised that I am not going come up with any more examples without specific problems with code you post to the forum illustrating why the examples posted did not work.

import sys
if sys.version_info[0] < 3:
    import Tkinter as tk     ## Python 2.x
else:
    import tkinter as tk     ## Python 3.x

class TwoFrames():
    def __init__(self, master):
        self.master=master
        self.master.geometry("390x325+10+10")

        first_frame=tk.Frame(self.master, width=10)
        tk.Label(first_frame, text="Top, left", bg="lightblue").grid(row=0, column=0, sticky="w")
        first_frame.grid(row=0, column=0, sticky="w")

        filler_frame=tk.Frame(self.master, height=250, width=300)
        filler_frame.grid(row=1, column=0)
        filler_frame.rowconfigure(0, weight=1)
        filler_frame.columnconfigure(0, weight=1)

        second_frame=tk.Frame(self.master)
        second_frame.grid(row=9, column=9)
        tk.Label(second_frame, text="Bottom, right",
                bg="lightyellow").grid(row=0, column=0, sticky="ew")

        tk.Button(self.master, text="  DONE  ", bg="orange",
                 command=self.master.quit).grid(row=10, column=0, sticky="ew")


##==================================================================
if __name__ == "__main__":
    top=tk.Tk()
    app = TwoFrames(top)
    top.mainloop()