Skip to content

_tkinter.TclError: invalid command name ".!canvas" #4314

@SaraFudl

Description

@SaraFudl

Prerequisites

  • Write a descriptive title.
  • Make sure you are able to repro it on the latest released version
  • Search the existing issues, especially the pinned issues.

Exception report

Last 1 Keys:
 &

Exception:
System.ArgumentOutOfRangeException: The value must be greater than or equal to zero and less than the console's buffer size in that dimension.
Parameter name: left
   at System.Console.SetCursorPosition(Int32 left, Int32 top)
   at Microsoft.PowerShell.Internal.VirtualTerminal.set_CursorLeft(Int32 value)
   at Microsoft.PowerShell.PSConsoleReadLine.ReallyRender(RenderData renderData, String defaultColor)
   at Microsoft.PowerShell.PSConsoleReadLine.ForceRender()
   at Microsoft.PowerShell.PSConsoleReadLine.Insert(Char c)
   at Microsoft.PowerShell.PSConsoleReadLine.SelfInsert(Nullable`1 key, Object arg)
   at Microsoft.PowerShell.PSConsoleReadLine.ProcessOneKey(ConsoleKeyInfo key, Dictionary`2 dispatchTable, Boolean ignoreIfNoAction, Object arg)
   at Microsoft.PowerShell.PSConsoleReadLine.InputLoop()
   at Microsoft.PowerShell.PSConsoleReadLine.ReadLine(Runspace runspace, EngineIntrinsics engineIntrinsics)
-----------------------------------------------------------------------
PS C:\Users\saram\Desktop\python> & C:/Users/saram/AppData/Local/Programs/Python/Python313/python.exe c:/Users/saram/Desktop/python/pingpong.py/main.py
Traceback (most recent call last):
  File "c:\Users\saram\Desktop\python\pingpong.py\main.py", line 16, in <module>
    ball.goto(ball.xcor()+1,ball.ycor()+1)
    ~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\saram\AppData\Local\Programs\Python\Python313\Lib\turtle.py", line 1774, in goto
    self._goto(Vec2D(x, y))
    ~~~~~~~~~~^^^^^^^^^^^^^
  File "C:\Users\saram\AppData\Local\Programs\Python\Python313\Lib\turtle.py", line 3199, in _goto
    screen._pointlist(self.currentLineItem),
    ~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\saram\AppData\Local\Programs\Python\Python313\Lib\turtle.py", line 744, in _pointlist
    cl = self.cv.coords(item)
  File "<string>", line 1, in coords
  File "C:\Users\saram\AppData\Local\Programs\Python\Python313\Lib\tkinter\__init__.py", line 2964, in coords
    self.tk.call((self._w, 'coords') + args))]
    ~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^
_tkinter.TclError: invalid command name ".!canvas"

Screenshot

N/A

Environment data

windows 10

Steps to reproduce

from turtle import Turtle, Screen
from paddle import Paddle
from ball import Ball

screen = Screen()
screen.bgcolor('black')
screen.setup(800,600)

r_paddle = Paddle((350,0))
l_paddle = Paddle((-350,0))
ball = Ball()

game_on = True
while game_on :
ball.goto(ball.xcor()+1,ball.ycor()+1)

screen.exitonclick()

Expected behavior

The expected behavior is the movement of the ball does not made this error

Actual behavior

The actual behavior is when the ball moved , this error appeard

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions