import tkinter
win = tkinter.Tk()
win.title("Listbox列表框")
win.geometry("800x600+600+100")
lbv=tkinter.StringVar()#绑定变量
#SINGLE与BORWSE作用相似,但是不支持鼠标按下后移动选中位置
lb=tkinter.Listbox(win,selectmode=tkinter.SINGLE,listvariable=lbv)
lb.pack()
for item in["good","nice","handsome","very good","verynice"]:
lb.insert(tkinter.END,item)
lb.insert(tkinter.ACTIVE,"cool")
Python中tkinter中控件的使用(6.Listbox列表框(双击打印下标和值))
