Tkinkter Grid() alignment not as expected: Python 2.7
Question: I am trying to use grid() function to align the labels and option menu side by
side. Here's the code which I used to create a simple GUI:

    
    
        from Tkinter import *
        win1 = Tk()
        win1.title("Chumma")
    
        #Option selection frame:
        f3 = Frame(win1)
        f3.grid(column=0,row=0)
        f3.pack() 
        l1 = Label(f3, text="Select the function which you want to perform: ", bg = "yellow")
        moduleList = StringVar(f3)
        moduleList.set("Normal Walk") #to display the default module name
        o1 = OptionMenu(f3, moduleList, "Normal Walk", "Brisk Walk", "Running", "Custom")
        b3 = Button(f3, text="Execute the option", fg="blue")
        b4 = Button(f3, text="Stop", fg="red")
    
        #Packing the stuffs in required order:
        l1.grid(row=0, column=0, sticky=W) #E means east
        l1.grid_rowconfigure(0, weight=1)
        l1.grid_columnconfigure(0, weight=1)
        l1.pack(fill = X, padx = 5)
        o1.grid(row=0,column=1)
        o1.grid_rowconfigure(0, weight=1)
        o1.grid_columnconfigure(1, weight=1)
        o1.pack()
        b4.pack()
    
        win1.mainloop()
    

The result is:

[![GUI
Window:](http://i.stack.imgur.com/HgWLB.png)](http://i.stack.imgur.com/HgWLB.png)

I am expecting the option menu `o1` to be at the right of the `l1`. If I
comment the pack command [ `l1.pack()` and `o1.pack()` ], the program is not
displaying any GUI at all.


Answer: After you call `grid`, a couple of lines later you call `pack` which cancels
out the use of grid. Use one or the other but not both for each widget. Sinc
`pack` defaults to `side='top'`, your widgets appear stacked on top of each
other.

The reason you see nothing if you comment out those _two_ calls to `pack` is
because you are still calling `b4.pack()`, and you can't use both `pack` and
`grid` for different widgets with the same parent.

Also, the calls to `rowconfigure` and `columnconfigure` need to be on the
parent widget. Calling them on the label widget will only affect widgets you
put inside the label (which is possible, but unusual)

