왜 애니메이션이 작동하지 않습니까? 프로그램을 실행할 때 모양이 움직이지 않습니다.Python Tkinter 애니메이션
from Tkinter import *
import time
class alien(object):
def __init__(self):
self.root = Tk()
self.canvas = Canvas(self.root, width=400, height = 400)
self.canvas.pack()
alien1 = self.canvas.create_oval(20, 260, 120, 360, outline='white', fill='blue')
alien2 = self.canvas.create_oval(2, 2, 40, 40, outline='white', fill='red')
self.canvas.pack()
self.root.mainloop()
def animation(self):
track = 0
while True:
x = 5
y = 0
if track == 0:
for i in range(0,51):
self.time.sleep(0.025)
self.canvas.move(alien1, x, y)
self.canvas.move(alien2, x, y)
self.canvas.update()
track = 1
print "check"
else:
for i in range(0,51):
self.time.sleep(0.025)
self.canvas.move(alien1, -x, y)
self.canvas.move(alien2, -x, y)
self.canvas.update()
track = 0
print track
alien()
* '??????????????????????????????????? ?????????????????????/'* 정말 도움이되지 않습니다. 기대하지 않거나 효과가없는 것은 어떻게됩니까? 예외가 발생하면 우리에게 전적으로주십시오. –
더 많은 물음표를주십시오 –
x - xis – mvitagames