Python Tkinter 学习笔记

//创建一个列表

 1 from Tkinter import *           # Importing the Tkinter (tool box) library 
 2 root = Tk()                     # Create a background window
 3                                 # Create a list
 4 li = 'Carl Patrick Lindsay Helmut Chris Gwen'.split()
 5 listb = Listbox(root)           # Create a listbox widget
 6 for item in li:                 # Insert each item within li into the listbox
 7     listb.insert(0,item)
 8 
 9 listb.pack()                    # Pack listbox widget
10 root.mainloop()                 # Execute the main event handler

OUTPUT:

posted @ 2015-12-09 20:42  鹏_VFX  阅读(327)  评论(0编辑  收藏  举报