Tkinter and frame resizing question
Martin Franklin
martin.franklin at westgeo.com
Tue Sep 25 06:32:00 EDT 2001
Martin Franklin wrote:
> Laura Creighton wrote:
>
>> I have a Tkinter screen that looks like this:
>> (sorry for the cheesy graphics; hope you have a
>> fixed width font!)
>>
>> -----------------------
>> | |
>> | big frame1 |
>> | |
>> | |
>> -----------------------
>> | |
>> | big frame2 |
>> | |
>> | |
>> -----------------------
>> | tiny frame (with |
>> |many control buttons)|
>> -----------------------
>>
>> When I use grid_remove() to remove a big frame, the window is
>> redrawn from the top down, and so my tiny frame moves upwards.
>> I don't want this. I'd prefer to anchor the tiny frame to the
>> bottom of the screen and then have the top of the window rise
>> or fall depending on how many big frames I grid. Does anybody
>> know how to do this?
>>
>> Laura Creighton
>>
>>
>
> Laura,
>
> Are you resticted to using the grid geometry manager? If not try
> .pack(side='bottom') (and then pack_forget())
>
> If you must use the grid manager you could try playing with the sticky
> bits (frame.grid(sticky='s')
>
> Martin.
>
>
-- offline comments -----
Laura,
post me some code I have done a similar thing and got it working.....
let me see...
Oh yes I had to repack all the lower frames in order......
from Tkinter import *
root=Tk()
f1=Frame(root)
b=Button(f1, text='Close', command=root.quit)
b.pack()
f1.pack(side='top')
f1a=Frame(root)
l=Label(f1a, text='This should be in te middle')
l.pack()
f1a.pack(side='top')
def forget_f1():
f1.pack_forget()
def remember_f1():
f1a.pack_forget()
f1.pack(side='top')
f1a.pack(side='top')
f2=Frame(root)
b1=Button(f2, command=forget_f1, text='Forget')
b1.pack()
b2=Button(f2, command=remember_f1, text='Remember')
b2.pack()
f2.pack(side='bottom')
root.mainloop()
HTH
Martin.
On Tuesday 25 September 2001 11:12, you wrote:
> using pack is no problem -- my problem is in communicating with the
> window manager. when tkinter resizes a window, because you have
> used pack_forget(), the window manager says, aha i will start drawing
> your new smaller or larger window FROM THE TOP DOWN. I would like
> it to draw if FROM THE BOTTOM UP. But this looks to be as impossible
> as I thought. so I will have to change the layout of the controls to
> make them on the top, because I can't have them hopping around
> like a frog in a fire.
>
> thanks anyway,
> Laura
More information about the Python-list
mailing list