from Tkinter import *
import tkFileDialog
import tkMessageBox
import os
import ttkimport serial
import timeit
import time######################################################################################
class MyApp:def __init__(self, parent):
########################################################
#Setup Framesself.MiddleFrame = Frame(parent) #Middle Frameself.MiddleFrame.pack()#GLOBAL VARIABLESself.chip_number = 0 #number of chip testing
############################################Middle Frame setup Label(self.MiddleFrame, text='Done').grid(row=8, column=1, sticky = E)self.Done = Canvas(self.MiddleFrame, bg="yellow", width=10, height=10)self.Done.grid(row=8, column=2) Label(self.MiddleFrame, text='Chip Number:').grid(row=9, column=1, sticky = E)#start buttonself.button1 = Button(self.MiddleFrame,state=NORMAL, command= self.start_pre)self.button1["text"]= "START"self.button1.grid(row=1, column=2, sticky = E)
###########################################
#Action of Start Buttondef start_pre(self):x = 0while x<10000: self.start_button()x=x+1#Talking to Boarddef start_button(self):#increase chip count number and updateself.chip_number += 1Label(self.MiddleFrame, text=str(self.chip_number)).grid(row=9, column=2, sticky = E)#reset-yellowself.reset_color() print "Still Working", self.chip_numberself.Done.configure(background="green")self.Done.update_idletasks() ###############################################################
#Color Boxes
#Resetdef reset_color(self):self.Done.configure(background="yellow")self.Done.update_idletasks()
###############################################################################################################
#Start Programs
root = Tk() #makes window
root.title("Interface")
myapp = MyApp(root) #this really runs program
root.mainloop() #keep window open
With my program, i first push the start button. I will print "still working" and the GUi will update chip number and blink done light over and over. The start button go to function that will execute 10000 times. However after 3000 iterations, the gui freeze, but the program is still print "still working". How do I keep the gui from crashing?