# import package import turtle # make turtle object # and set size sc = turtle.Screen() sc.setup(400,300) # set turtle screen title turtle.title("Turtle Window For GFG")
# import package import turtle # set turtle speed to slowest # for better understandings turtle.speed(1) # motion with stamps # and their ids turtle.forward(50) id1 = turtle.stamp() turtle.forward(50) id2 = turtle.stamp() turtle.forward(50) id3 = turtle.stamp() # hide the turtle to # clarify stamps turtle.ht() # clear the stamps # of id : id1 and id3 turtle.clearstamp(id1) turtle.clearstamp(id3)
# import packages import turtle import random # global colors col = ['red', 'yellow', 'green', 'blue', 'white', 'black', 'orange', 'pink'] # method to call on timer deffxn(): global col ind = random.randint(0, 7) # set background color of the # turtle screen randomly sc.bgcolor(col[ind]) # set screen sc = turtle.Screen() sc.setup(400, 300) # loop for timer for i inrange(10): turtle.ontimer(fxn, t=400*(i+1))