python3 KTinker网格加载时间非常长

时间:2018-07-16 15:53:17

标签: python

我正在尝试编写一个相当基本的网格,我注意到它会相当快地生成,但是要花几分钟才能真正显示任何内容。它遍历循环,但窗口是平淡的,直到几分钟后所有内容立即出现

i = 0
for i,element in enumerate(headerArray):
    label = tk.Label(text=element).grid(row=0,column=i)

for itter in outputArray:
    line=re.split(r'\s{2,}',itter)

    if not (nextLineColor is None):
        nextLineColor = None

    if(len(line) == 1):
        continue
    elif(len(line) == 6):
        for j,col in enumerate(line):
            ele = None
            if(j==0):
                ele = tk.Button(self,text=col)
                ele.config(command=lambda val=col: self.node_selected(val))
            else:
                ele = tk.Label(text=col)
            ele.grid(row=i,column=j)
        i = i + 1

0 个答案:

没有答案