Raise Frame on top in PanedWindow in tkinter python 3.5
<p>I have a frame in PanedWindow which i need on every tkinter GUI (in this case it's topFrame). Below it are many frames and I want to switch between those frame on button click (just like in any software where the top portion of screen is fixed and clicking on buttons the lower portion of GUI changes).</p>

<p>I know i need grid layout for it. But, it is not happening and i am not getting a solution anywhere.I have researched a lot on this topic everywhere but this solution is nowhere. Here is my code... i have written in comments those code which i feel are not working fine.</p>

<pre><code>#python 3.5

from tkinter import *

#function to raise the frame on button click
def raiseFrame(frame):
    frame.tkraise()


m = PanedWindow(height=500, width=1000, orient=VERTICAL)
m.pack(fill=BOTH, expand=1)

#to expand the column and row to fill the extra space
m.grid_columnconfigure(index=0, weight=1) #this code is not working as it should
m.grid_rowconfigure(index=0, weight=1)    #this code is not working as it should

#top frame has two buttons which switches the bottom frames
topFrame = Frame(m, bg="blue")
m.add(topFrame)

button1 = Button(topFrame, text="Raise Frame 2", command=lambda: raiseFrame(frame2)) #raises frame 2 on clicking it
button1.pack(side=LEFT)
button2 = Button(topFrame, text="Raise Frame 1", command=lambda: raiseFrame(frame1)) #raises frame 1 on clicking it
button2.pack(side=LEFT)

#bottomframe acts as container for two other frames which i need to switch
bottomframe = Frame(m, bg="orange")
m.add(bottomframe)

frame1 = Frame(bottomframe, bg="yellow")
frame1.grid(row=0, column=0, sticky="news")                ##   sticky is not working   ##
frame2 = Frame(bottomframe, bg="green")
frame2.grid(row=0, column=0, sticky="news")                ##   sticky is not working   ##

label1 = Label(frame1, text="i should change")
label1.pack(padx=10, pady=10)
label2 = Label(frame2, text="i am changed !!")
label2.pack(padx=10, pady=10)

mainloop()
</code></pre>

<p>1)Please correct my code.</p>

<p>2)Explain me why in the "topFrame" even though i have not written</p>

<pre><code>topFrame.pack(fill=BOTH, expand=True)
</code></pre>

<p>my code is showing the above property and it's expanding as well as filling both X and Y.
Same goes for the bottomFrame, it's orange colour is filling the entire space which does not happen in normal frames. So, is it some special feature of PanedWindow ?</p>