I'm making a simple pong game and and trying to make it with OOP. I'm trying to get the turtles to move using ycor. It's intended to call the 'objects_up' method to move them up and do then ill do the same for x and y. I've tried all sorts of indentation, not using a method and moving wn.listen outside of the class. What am I doing wrong? I keep getting the error :
Edit1: Made Paddles a subclass of turtle. I'm getting a new, different error:
Edit2: Followed the advice of @OneCricketeer and I'm using a lambda now. The program runs fine but the keypress doesn't work and i'm getting a plethora of errors: e.g
````
File "C:\Users\okpla\AppData\Local\Programs\Python\Python311\Lib\turtle.py", line 1294, in _incrementudc
raise Terminator
````
This is the code:
````
from turtle import Screen,Turtle
wn = Screen()
wn.title("Pong by CGGamer")
wn.bgcolor("black")
wn.setup(width=800, height=600)
wn.tracer(0)
class Paddles(Turtle):
def __init__(self,position,size):
super().__init__()
self.position = position
self.size = size
self.speed(0)
self.shape("square")
self.shape("square")
self.color("white")
self.shapesize(size,1)
self.penup()
self.setposition(position)
wn.listen()
wn.onkeypress(lambda self:self.sety(self.ycor() + 20),"w")
paddle_a = Paddles((-350,0),5)
paddle_b = Paddles((350,0),5)
ball = Paddles((0,0),1)
````