Attachment 'lecture9_password.py'
Download
Toggle line numbers
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.You are not allowed to attach a file to this page.