Faqts : Computers : Programming : Languages : Python : Tkinter

+ Search
Add Entry AlertManage Folder Edit Entry Add page to http://del.icio.us/
Did You Find This Entry Useful?

23 of 26 people (88%) answered Yes
Recently 10 of 10 people (100%) answered Yes

Entry

how to hide a widget (Button) in container?

Mar 31st, 2009 10:46
Scott Mandarich, Daniel Haertle, bin zhang, http://www.pythonware.com/library/tkinter/introduction/


from Tkinter import *
container = Tk()
Label(container, text="Hello, world!").pack()
def disappear(*args):
	button.pack_forget()
button = Button(container, text="Press me to disappear", 
command=disappear)
button.pack()
container.mainloop()
Description:
Hiding is done by the pack_forget method. For the other geometry
managers the respective command is place_forget and grid_forget. 
The widget you want to hide must be named, e.g. you cannot hide the
label in the example above.
You can redisplay the widget by repacking it.
http://www.golfgolfcourses.com/index.php?q=Georgia