python写的一个小球碰撞程序,为什么小球不出现?谢谢
from tkinter import*import randomimport timeclass Ball: def __init__(self, canvas, color): self.canvas = canvas self.id = canvas.create_oval(10,10,25,25,fill=color) self.canvas.move(self.id, 245, 100) def draw(self): self.canvas.move(self.id,0,-1)#____________________________________________________________tk = Tk()tk.title("Game")tk.resizable(0,0)tk.wm_attributes("-topmost",1)canvas = Canvas(tk,width = 500,height=400,bd=0,highlightthinckness=0)canvas.pack()tk.update()#____________________________________________________________ball = Ball(canvas,✀red✀)while 1: ball.draw() tk.update_idletasks() tk.update()只写了一半,是看书上的,不知道为什么运行的时候没有小球出现,哪里错了?谢谢