update a window with tkinter ...
John McMonagle
jmcmonagle at velseis.com.au
Thu Jul 27 19:04:27 EDT 2006
On Thu, 2006-07-27 at 19:56 +0200, Laurent Hermann wrote:
> Hi I'm new on this list so let me say hello to everybody.
>
>
> I have a little problem with tkinter but I could not find the solution
> on the net so I ask it here...
>
>
> The thing I want to do is simple but I cannot, I would like to have a
> tkinter window that update itself during the program is running, I
> created a small exemple :
>
>
>
>
> from Tkinter import *
> import time
>
>
> fen1=Tk()
> can1=Canvas(fen1,bg='dark grey',height=100,width=100)
> can1.pack()
>
>
> a=0
>
>
> while(a<10):
> time.sleep(1)
> tex1=can1.create_text (10*a,10*a,text=a)
> a=a+1
>
Change the loop to:
while a<10:
time.sleep(1)
can1.create_text(10*a, 10*a, text=str(a)) # a should be a string
for a canvas text object
a += 1
can1.update()
>
> can1.pack()
Don't need to repack canvas widget.
> fen1.mainloop()
>
Regards,
John
--
This message has been scanned for viruses and
dangerous content by MailScanner, and is
believed to be clean.
More information about the Python-list
mailing list