我正在创建一个列表,它从Tkinter文本区域获取每一行。我想将列表中的每一行附加到三个标签上,列表中的每个索引都移动到下一个标签上,当它循环回标签1时,更新列表中下一个的值
现在我有这个,但不知道如何循环回更新标签:
def iterate_linesRest(self):
for line in self.textarea.get('1.0', 'end-1c').splitlines():
# Iterate lines
if line:
MainFrame.pipelinelist4.append(line)
labels=[]
for x in MainFrame.pipelinelist4[]:
label = Label(self,text =x)
labels.append(label)
从长远来看,我希望发生类似的事情:
pipelinelist = ["Hello", "Hi", "Apple", "John", "Mike", "Joe"]
Label 1 = Hello Label2 = Null, Label 3 = Null
Label 1 = Hi Label2 = Hello Label 3 = Null
Label 1 = Apple Label 2 = Hi Label 3 = Hello
Label 1 = Mike Label2 = Apple Label 3 = Hi
......
直到它到达列表的末尾
Label 1 = Null Label 2 = Null Label 3 = Joe
然后标签3将为Null或空
做了一些研究,我觉得创建一个列表队列比创建一个复杂的循环结构要好得多
我一直在使用您对队列的想法:
相关问题 更多 >
编程相关推荐