Dec-09-2018, 01:44 AM
from tkinter import * import random import time tk=Tk() canvas=Canvas(tk, width=500, height=400) canvas.pack() class Ball: def__init__(self): self.shape = canvas.create_oval(10,10,60,60,fill="red") self.xspeed= 3 self.yspeed= 4 def move(self): canvas.move(self.shape, self.xspeed, self.yspeed) position= canvas.coords(ball) if position[3]>= 400 or position[1] <= 0: self.yspeed= -self.yspeed if position[2] >= 500 or position[0] <= 0: self.xspeed= -self.xspeed ball1= Ball() while True: ball1.move() tk.update() time.sleep(.01)I do double underscore and I still get syntax error