Skip to content
Advertisement

Turtle Graphics: Onscreenclick doesn’t work

학번, 이름, 전공

JavaScript

it says that Exception in Tkinter callback Traceback (most recent call last): File “C:UserssuyeoAppDataLocalProgramsPythonPython39libtkinter_init_.py”, line 1892, in call return self.func(*args) File “C:UserssuyeoAppDataLocalProgramsPythonPython39libturtle.py”, line 674, in eventfun fun(x, y) TypeError: ‘str’ object is not callable

Advertisement

Answer

onscreenclick and onkeypress setup callbacks – functions that are called when those events happen. You only need to call these functions once for each event or key – unless you need to modify them. AFAIK, they don’t return any values. onscreenclick takes one parameter: a function that takes 2 parameters, the x and y coordinates. onkeypress takes 2 parameters: the callback function and the key.

JavaScript
User contributions licensed under: CC BY-SA
8 People found this is helpful
Advertisement