# coding=gbk# 运行结果:https://s1.ax1x.com/2018/04/16/CeK7l9.gifimport tkinterwindow = tkinter.Tk()window.title("jkn1234")window.geometry("500x500")var1 = tkinter.StringVar()text = tkinter.Label( window, bg = 'yellow', width = 10, textvariable = var1)text.pack()def print_selection(): var1.set(listbox.get(listbox.curselection()))button = tkinter.Button( window, text = 'print selection', command = print_selection)button.pack()# listbox初始化值var2 = tkinter.StringVar()var2.set((11, 22, 33, 44))listbox = tkinter.Listbox( window, listvariable = var2)# listbox插入删除值listbox.insert('end', "end")listbox.insert(0, 1)listbox.insert(1, "second")listbox.delete(2)listbox.pack()window.mainloop()