By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
439,986 Members | 1,583 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 439,986 IT Pros & Developers. It's quick & easy.

hiding a frame in tkinter

P: n/a
hello everybody
suppose we have a tk frame in witch there are lots of frame,
and we want to hide one of them(frames)
what should we do , and what will be the result in pack or grid goemetry?
thank you in advanced
Jul 18 '05 #1
Share this Question
Share on Google+
4 Replies


P: n/a
faramarz,

Most likely, you'll need to replace the 'forgotten' frame with another
one or other widget. You can immediately do *.pack() and it will
replace the frame (assumming you haven't already packed something else
there).

Harlin Seritt

Jul 18 '05 #2

P: n/a
lots of thanks to the nice guys of python community,

i do it ,and it works just as i want,
but unfourtunatly a new problem arise.
the problem is :
when i use pack_forget , i just work,
but suppose we want to call it in func or method,
i choose to test it in a func:

def do_unpack(f):
f.pack_forget()
....
b=Button(f3,text="hello",command=do_unpack(f3))

it does not work & the interpreter does not claim any error.
so how can i send a pointer (refrence) of an object to a func or method.
should i use any prop. of frame instance(ex:f3)?
in other words i want to know how can i send
arg as refrence in python.(ex: object of general MyClass)?
thank you again

i am a real newbie in python & tkinter,
Jul 18 '05 #3

P: n/a
"faramarz yari" wrote:
def do_unpack(f):
f.pack_forget()
...
b=Button(f3,text="hello",command=do_unpack(f3))

it does not work & the interpreter does not claim any error.


it works perfectly fine, but it doesn't do what you want.

do_unpack(f3)

is a function call, so you're calling the function *before* you create
the button, and you're then passing the return value (None) to the
button widget.

if you want to use the function as a callback, use a lambda:

b=Button(..., command=lambda: do_unpack(f3))

or a local function

def cb():
do_unpack(f3)
b=Button(..., command=cb)

</F>

Jul 18 '05 #4

P: n/a
thanks
Jul 18 '05 #5

This discussion thread is closed

Replies have been disabled for this discussion.