Attachment 'lecture4_homework.py'
Download
Toggle line numbers
1 #!/usr/bin/python
2
3 from Tkinter import * #This interface allow us to draw windows
4
5
6 def DrawList():
7 plist = ['Liz','Tom','Chi']
8
9 for item in plist:
10 listbox.insert(END,item);
11
12
13 root = Tk() #This creates a window, but it won't show up
14
15 listbox = Listbox(root)
16 button = Button(root,text = "press me",command = DrawList)
17
18 button.pack()
19 listbox.pack() #this tells the listbox to come out
20 root.mainloop() #This command will tell the window come out
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.