Advertisement
bobhig

Turtle_art

Jan 26th, 2019
217
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.70 KB | None | 0 0
  1. #!/bin/python3
  2. #python 101 Turtle art
  3. #Some code remixed from Raspberry Pi Modern Art project
  4.  
  5. from turtle import *
  6. from random import *
  7.  
  8. tricky = Turtle()
  9.  
  10. def randomcolour(t_name): # random change to the colour of the turtle
  11.     colormode(255)
  12.     red = randint(0, 255)
  13.     green = randint(0, 255)
  14.     blue = randint(0, 255)
  15.     t_name.color(red, green, blue)
  16.  
  17.  
  18. def draw_circle(t_name, x, y, r): # draw a circle using the dot library function
  19.     randomcolour(t_name) # call random colour
  20.     t_name.penup()
  21.     t_name.goto(x,y)
  22.     t_name.dot(r*2)
  23.     t_name.pendown()
  24.  
  25.  
  26. draw_circle(tricky,0,100,200)
  27. randomcolour(tricky)
  28. tricky.pensize(4)
  29. tricky.forward(200)
  30. draw_circle(tricky,50,100,75)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement