[Tkinter-discuss] loop delay

Paul Simon psimon at sonic.net
Mon Oct 22 00:31:06 CEST 2012

I' m a novice python programmer and now starting to learn tkinter for a 
front and db back end to replace an application written MS Access/VBA.  The 
following program doesn't work as I expected as data is not written to the 
text box until the def is exited.  If I include a print statement with the 
increment it is printed.

Any suggestions are welcome.

from Tkinter import *

from time import sleep

def count (event):

#while n < 2:

for n in range(2):

print str(n)

text_button.insert(2.0, str(n))

sleep (2)

root = Tk()


frame = Frame(root,bg="red", width=100,height=100)

text_button = Text(frame,fg ="green",bg="blue",height=1,width=7)



quit_button = Button(frame, text="QUIT",fg="red", command=root.destroy)





Paul Simon

More information about the Tkinter-discuss mailing list