import turtle
import time
class Square:
def __init__(self, color='red', pos=(0, 0)):
self.__pen = turtle.Turtle('square')
self.__set_pen(pos, color)
def __set_pen(self, pos, color):
self.__pen.shapesize(5, 5)
self.__pen.up()
self.__pen.goto(pos)
self.__pen.color(color)
wn.update()
def rotate(self, angle): # CLOCKWISE
for i in range(angle):
self.__pen.right(1)
wn.update()
time.sleep(0.01)
wn = turtle.Screen()
wn.tracer(False)
s01 = Square(color='green', pos=(100, 100))
s01.rotate(-60)
wn.mainloop()
This is my code that im working on but how do I make it work with a negative input in s01.rotate() and rotate counter clockwise. I tired inputing a negative integer but it wouldn't rotate at all.