我正在尝试构建一个动态的组合框。因此,当更新特定文本文件时,组合框将跟随。但是,我在构建列表视图时遇到问题。我收到以下错误。 ValueError:行序列长度错误。以下是我正在使用的代码。我的列表只有一列。我的列表是['str1','str2','str3','... etc']。有人可以帮助我理解我所缺少的东西。谢谢!
def newlist(self, widget):
LRU_list = gtk.ListStore(str)
for i in range(len(LRU)):
LRU_list.append(LRU[i])<---- Value Error
for row in LRU_list:
print(row[:])
你需要使用一个列表:
def newlist(self, widget):
LRU_list = gtk.ListStore(str)
for i in range(len(LRU)):
LRU_list.append([LRU[i]])<---- Value Error
for row in LRU_list:
print(row[:])