I want to make a button be pressed on a screen using turtle python. Its not difficult, but I tried to do it using a class and it didn't work:
class Window:
def __init__(self):
self.name = 'test'
def deletewindow(self, x, y):
if x < 10 and x > 0 and y < 10 and y > 0:
del self
wn.listen()
wn.onscreenclick(deletewindow, 1)
And I get this error:
Exception in Tkinter callback
Traceback (most recent call last):
File "/usr/lib/python3.8/tkinter/__init__.py", line 1883, in __call__
return self.func(*args)
File "/usr/lib/python3.8/turtle.py", line 675, in eventfun
fun(x, y)
TypeError: deletewindow() missing 1 required positional argument: 'y'
question from:
https://stackoverflow.com/questions/65911458/onscreenclick-not-working-in-turtle-python 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…