Mar-12-2018, 09:14 PM
I was making this game from the Python book and I made it exactly as it had it in the book but when I asked python to check it before I ran it, it said,"inconsistent use of tabs and spaces in indentation" for line 7. Please tell me if you notice something wrong.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 |
import time import random from tkinter import * class Ball: def __init__( self , canvas, color): self .canvas = canvas self . id = cavas.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() canvas = Canvas(tk, width = 400 , height = 400 ) canvas.pack() tk.title( "Game" ) tk.wm_attributes( "-topmost" , 1 ) tk.title( "Game" ) canvas = Canvas(tk, width = 400 , height = 400 , bd = 0 , highlightthickness = 0 ) canvas.pack() tk.update() ball = Ball(canvas, 'red' ) while 1 : ball.draw() tk.update_idletasks() tk.update() time.sleep( 0.01 ) |