[Tkinter-discuss] loop delay

Lynn Oliver raycores at gmail.com
Mon Oct 22 06:02:41 CEST 2012


My experience, which admittedly is limited, has been that a lot of the ins and outs are not well documented.  

For my current program I went through three iterations of the UI: the first when I found out about validators; the second when I learned how to use trace functions; and (hopefully) the last when I realized I could just bind the key_up events and do everything I needed right there.  

On Oct 21, 2012, at 8:39 PM, "Paul Simon" <psimon at sonic.net> wrote:

> Thank you!  Just what I was looking for and will have to re-read the documentation.  Sorry about the indents:  Copying from linux to windows sometimes does some strange things and although I tried to fix it...
>  
> Paul
> "Lynn Oliver" <raycores at gmail.com> wrote in message news:7BF8A3B5-45A3-499C-89C8-34F1EC25103A at gmail.com...
> Maybe the idle loop needs to run so things get done.  Try calling update_idletasks().  Be nice to have some indents...
> 
> Lynn
> 
> On Oct 21, 2012, at 3:31 PM, Paul Simon <psimon at sonic.net> wrote:
> 
>> 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()
>> 
>> root.geometry("300x300+10+10")
>> 
>> frame = Frame(root,bg="red", width=100,height=100)
>> 
>> text_button = Text(frame,fg ="green",bg="blue",height=1,width=7)
>> 
>> text_button.bind("<Button-1>",count)
>> 
>> text_button.pack(side=LEFT)
>> 
>> quit_button = Button(frame, text="QUIT",fg="red", command=root.destroy)
>> 
>> quit_button.pack(side=LEFT)
>> 
>> frame.pack()
>> 
>> root.mainloop()
>> 
>> -------------------------------
>> 
>> Paul Simon
>> 
>> 
>> 
>> _______________________________________________
>> Tkinter-discuss mailing list
>> Tkinter-discuss at python.org
>> http://mail.python.org/mailman/listinfo/tkinter-discuss
> 
> 
> 
> _______________________________________________
> Tkinter-discuss mailing list
> Tkinter-discuss at python.org
> http://mail.python.org/mailman/listinfo/tkinter-discuss
> _______________________________________________
> Tkinter-discuss mailing list
> Tkinter-discuss at python.org
> http://mail.python.org/mailman/listinfo/tkinter-discuss

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/tkinter-discuss/attachments/20121021/7c288313/attachment-0001.html>


More information about the Tkinter-discuss mailing list