# create the listbox widgets
def onselect(evt):
# Note here that Tkinter passes an event object to onselect()
w = evt.widget
index = int(w.curselection()[0])
value = w.get(index)
print(value)
listbox = Listbox(main_frame, selectmode=tk.SINGLE)
listbox.config(width=int(screen_width/50), height=int(screen_width/50))
for index in range(0, 5):
listbox.insert(tk.END, "video"+str(index))
listbox.yscrollcommand = True
# listbox.grid(row=1, column=2)
listbox.place(x=screen_width-int(screen_width/3), y=0)
# <Double-1> for double click
listbox.bind('<Double-1>', onselect)
selection = listbox.curselection()
我无法为listbox
添加滚动条,而错误会突然显示"Scrollbar" is not defined
。有谁能够帮我?