0

I am making a ping pong game, in the line code ball movement

ball.goto(ball.xcor() +2, ball.ycor() +2)

after run the code it appear me this error message

Exception has occurred: TclError
invalid command name ".!canvas"
  File "C:\Users\ELNOUR\Desktop\mypython\.idea\pingpong.py\main.py", line 29, in <module>
    ball.goto(ball.xcor() +2, ball.ycor() +2) 
    ~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
_tkinter.TclError: invalid command name ".!canvas"

I am trying to make the ball when hits the paddle , the score of the paddle increase and only one because it increase infinit untill I move the paddle

3
  • 2
    It is better to provide a minimal reproducible example so that we can just copy and execute to reproduce the issue. Commented Dec 17, 2024 at 15:05
  • The error message is telling you that the tkinter.Canvas object ball has been destroyed which is why ball.goto(...)/ball.xcor()/ball.ycor() fails. Without a minimal reproducible example, we cannot help you further Commented Dec 17, 2024 at 17:06
  • Oh ,thanks . I’ll do that Commented Dec 19, 2024 at 9:36

0

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.