Friday, January 27, 2023

With_Class

 Learning to use turtle as an add-on to a tkinter project:

                                                     



from turtle import TurtleScreen, RawTurtle

import turtle

my_screen = turtle.Screen()
my_screen.bgcolor('pink')

class Squares(RawTurtle):
def _init_(self):
super()._init_(self)

t1 = Squares(my_screen, shape = 'circle')
t1.width(3)
t1.forward(50)

t2 = Squares(my_screen, shape='square')
t2.width(3)
t2.color('green')
t2.backward(75)

my_screen.mainloop()

No comments: