1
self.__tracksListBox = Listbox(self.__master, width=100, height=25).grid(row=0, column=1,
rowspan=4)
我想顯示一個列表框選擇,但下面的錯誤被拋出:Listbox被視爲Nonetype,爲什麼?
Exception in Tkinter callback
Traceback (most recent call last):
File "C:\Python33\lib\tkinter\__init__.py", line 1475, in __call__
return self.func(*args)
File "C:\Users\aawiesinger5000\Desktop\CS 110 Final Project\layoutGUI.py", line 213, in showTracks
self.__tracksListBox.insert(END, titleStr)
AttributeError: 'NoneType' object has no attribute 'insert'
當我嘗試使用列表框這樣的:
if tracks:
titleStr = ""
for track in tracks:
titleStr += track + "\n"
self.__tracksListBox.insert(END, titleStr)
有誰知道爲什麼?
謝謝!