hi ..... i'm making an animation but am having a problem Tkinter.
the problem is that when i open the file with python 2.5 and execute the code then it works but by just double clicking on the file icon the program don't not work properly.its does not show the animation.it just show all the circle at once. can anyone tell me why its so.....
here is my codes.....

from time import sleep
import Tkinter

frame=Tkinter.Frame()
frame.pack()

canvas =Tkinter.Canvas(frame,bg = 'white',width=500, height=500)
canvas.pack()

def generate():
for i in range(0,100,5):
#sleep(1)
frame.after(1000)
canvas.create_oval(200-i,300-i,210+i,310+i) #my first oval
print i
#frame.after(2000)
#canvas.create_oval(220,320,230,330) # my second oval

button=Tkinter.Button(frame,fg="blue", text="GENERATE", command=generate).pack()


frame.mainloop()

Pls do care to see, after you post. The tag you used may be right, but not right enough for proper indentation to show what you intended, the tags are not matching in sense of case. Also you still have a way to edit, your post. Dont just post same question/code, repeatedly when you see something is wrong.

hi ..... i'm making an animation but am having a problem Tkinter.
the problem is that when i open the file with python 2.5 and execute the code then it works but by just double clicking on the file icon the program don't not work properly.its does not show the animation.it just show all the circle at once. can anyone tell me why its so.....
here is my codes.....

from time import sleep
import Tkinter

frame=Tkinter.Frame()
frame.pack()

canvas =Tkinter.Canvas(frame,bg = 'white',width=500, height=500)
canvas.pack()

def generate():
for i in range(0,100,5):
#sleep(1)
frame.after(1000)
canvas.create_oval(200-i,300-i,210+i,310+i) #my first oval
print i
#frame.after(2000)
#canvas.create_oval(220,320,230,330) # my second oval

button=Tkinter.Button(frame,fg="blue", text="GENERATE", command=generate).pack()


frame.mainloop()

hi ..... i'm making an animation but am having a problem Tkinter.
the problem is that when i open the file with python 2.5 and execute the code then it works but by just double clicking on the file icon the program don't not work properly.its does not show the animation.it just show all the circle at once. can anyone tell me why its so.....
here is my codes.....

rom time import sleep
import Tkinter

frame=Tkinter.Frame()
frame.pack()

canvas =Tkinter.Canvas(frame,bg = 'white',width=500, height=500)
canvas.pack()

def generate():
for i in range(0,100,5):
#sleep(1)
frame.after(1000)
canvas.create_oval(200-i,300-i,210+i,310+i) #my first oval
print i
#frame.after(2000)
#canvas.create_oval(220,320,230,330) # my second oval

button=Tkinter.Button(frame,fg="blue", text="GENERATE", command=generate).pack()


frame.mainloop()

Your code is loaded with errors. I assume this is something like you want, it actually works:

import Tkinter as tk
import time

def generate():
    for i in range(0,100,5):
        time.sleep(0.3)
        canvas.create_oval(200-i, 300-i, 210+i, 310+i)
        # needed after time.sleep
        canvas.update()
        # for testing only
        print i
    canvas.create_oval(200, 300, 210, 310, fill='red')


frame = tk.Frame()
frame.pack()

canvas = tk.Canvas(frame, bg='white', width=500, height=500)
canvas.pack()

button = tk.Button(frame, fg="blue", text="GENERATE", command=generate)
button.pack()

frame.mainloop()
This question has already been answered. Start a new discussion instead.