Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # t_color_alt_text.py -- and text_outline
- from turtle import Screen, Turtle
- from itertools import cycle
- COLORS = cycle(["red","blue","yellow","green"])
- STRING = "Hello World !!!!!"
- FONT_SIZE = 60
- DELTA_SIZE = 4
- FONT = ("Ariel", FONT_SIZE, "italic")
- tu = Turtle(visible=False)
- tu.speed('fastest')
- font_width = 2
- xy = [z-font_width-1 for z in range(1,(font_width+1)*2)]
- OUTLINE_FONT = [(x,y) for x in xy for y in xy]
- screen = Screen()
- screen.tracer(0, 0)
- tu.penup()
- X, Y = -300, 100
- tu.goto(X, Y)
- for letter in STRING+' ':
- oldx = tu.xcor()
- tu.write(letter, font=FONT)
- tu.color('black')
- if letter != ' ':
- for x,y in OUTLINE_FONT:
- tu.setposition(oldx+x, Y+y)
- tu.write(letter, move=True, font=FONT)
- tu.color(next(COLORS))
- tu.setposition(oldx, Y)
- tu.write(letter, move=True, font=FONT)
- screen.update()
Add Comment
Please, Sign In to add comment