Advertisement
here2share

# Tk_peekaboo_buttons.py

May 27th, 2018
319
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.61 KB | None | 0 0
  1. # Tk_peekaboo_buttons.py
  2.  
  3. from Tkinter import *
  4. root = Tk()
  5.  
  6. def demo(*args):
  7.     def show_label():
  8.         label.grid()
  9.     def hide_label():
  10.         label.grid_remove()
  11.    
  12.     disp = Entry(root)
  13.     disp.grid(column=0, row=0, columnspan=4)
  14.  
  15.     label = Label(text="Peek-A-Boo!")
  16.     label.grid(column=0, row=1, columnspan=4, sticky=N+S+E+W)
  17.    
  18.     button1 = Button(text="Click To Hide Label",
  19.               command=hide_label)
  20.     button1.grid(column=0, row=2, columnspan=4, sticky=N+S+E+W)
  21.  
  22.     button2 = Button(text="Click To Show Label",
  23.               command=show_label)
  24.     button2.grid(column=0, row=3, columnspan=4, sticky=N+S+E+W)
  25.  
  26. demo()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement