Attachment 'lecture9_password.py'

Download

   1 #!/usr/bin/python
   2 
   3 from Tkinter import *
   4 
   5 
   6 def GetValue():
   7     password = ent.get()
   8     if password == 'Elaine':
   9         button['bg'] = 'yellow'
  10     else:
  11         ent.insert(0,'wrong password')
  12 
  13     
  14 
  15 
  16 
  17 root = Tk()
  18 
  19 
  20 lab = Label(root, text = 'Password')
  21 ent = Entry(root, bg = 'white')
  22 button = Button(root, text = 'Enter Password', command = GetValue)
  23 
  24 
  25 ent.focus()
  26 
  27 lab.pack(anchor = W)
  28 ent.pack(anchor = W)
  29 button.pack(ancho = E)
  30 
  31 
  32 root.mainloop()

Attached Files

To refer to attachments on a page, use attachment:filename, as shown below in the list of files. Do NOT use the URL of the [get] link, since this is subject to change and can break easily.
  • [get | view] (2005-04-27 13:13:02, 0.6 KB) [[attachment:Lecture3_example1.py]]
  • [get | view] (2005-04-27 13:52:38, 0.7 KB) [[attachment:Lecture3_example2.py]]
  • [get | view] (2005-04-29 14:35:01, 767.5 KB) [[attachment:lecture10_pictures.py]]
  • [get | view] (2008-06-27 13:22:12, 0.0 KB) [[attachment:lecture3example1.txt]]
  • [get | view] (2005-04-28 00:44:04, 0.2 KB) [[attachment:lecture4_but.py]]
  • [get | view] (2005-04-28 00:44:35, 0.3 KB) [[attachment:lecture4_button.py]]
  • [get | view] (2005-04-28 00:44:22, 1.1 KB) [[attachment:lecture4_buttonc.py]]
  • [get | view] (2005-04-28 00:46:20, 0.4 KB) [[attachment:lecture4_first.py]]
  • [get | view] (2005-04-28 00:46:55, 0.5 KB) [[attachment:lecture4_homework.py]]
  • [get | view] (2005-04-28 00:47:56, 0.1 KB) [[attachment:lecture5_chieh.py]]
  • [get | view] (2005-04-28 00:48:10, 0.1 KB) [[attachment:lecture5_stacy.py]]
  • [get | view] (2005-04-28 00:49:57, 0.2 KB) [[attachment:lecture6_chieh.py]]
  • [get | view] (2005-04-28 00:49:43, 0.3 KB) [[attachment:lecture6_stacy.py]]
  • [get | view] (2005-04-28 00:51:59, 0.5 KB) [[attachment:lecture7_homework.py]]
  • [get | view] (2005-04-28 00:51:45, 0.4 KB) [[attachment:lecture7_text.py]]
  • [get | view] (2005-04-29 14:32:06, 0.5 KB) [[attachment:lecture8_ifexample.py]]
  • [get | view] (2005-04-29 14:34:05, 0.5 KB) [[attachment:lecture9_password.py]]
 All files | Selected Files: delete move to page copy to page

You are not allowed to attach a file to this page.

Unable to edit the page? See the FrontPage for instructions.