有如下Python代码,执行该代码,说法不正确的是?()
import tkinter as tk window = tk.Tk() window.title('ListBox') window.geometry('300x350') var1 = tk.StringVar() label = tk.Label(window, bg='yellow', width=4, height=2, textvariable=var1) label.pack() def print_selection(): value = listbox.get(listbox.curselection()) var1.set(value) button = tk.Button(window, text='print selection', command=print_selection) button.pack() var2 = tk.StringVar() var2.set((11,22,33,44)) listbox = tk.Listbox(window,listvariable=var2) listbox.pack() listitems = [1,2,3,4] for item in listitems: listbox.insert('end', item) listbox.insert(1,'first') listbox.insert(1,'second') listbox.delete(1) window.mainloop()
当前窗口的名称为ListBox
当前窗口有一个按钮,名字为print selection
当前窗口列表框中有"second"数据项
当前窗口列表框中共有9条数据项