from turtle import * from math import * from kandinsky import * penup() hideturtle() def fillEllipsis(centerI, centerJ, a, b, theta, R, color): a2 = a*a b2 = b*b for i in range(centerI-5*R,centerI+5*R): for j in range(centerJ-5*R,centerJ+5*R): deltaI = i-centerI deltaJ = j-centerJ x = cos(theta)*deltaI + sin(theta)*deltaJ y = sin(theta)*deltaI - cos(theta)*deltaJ if (x*x/a2+y*y/b2 <= R): set_pixel(i, j, color) def petal(): circle(10, 90) left(180) circle(10, 90) left(60) def flower(): petal() petal() petal() petal() petal() petal() #bouquet de fleurs fillEllipsis(170,53,4,4,4,4,(255,215,0)) fillEllipsis(170,103,4,4,4,4,(255,215,0)) fillEllipsis(220,113,4,4,4,4,(255,215,0)) fillEllipsis(120,113,4,4,4,4,(255,215,0)) fillEllipsis(220,68,4,4,4,4,(255,215,0)) fillEllipsis(120,68,4,4,4,4,(255,215,0)) width(2) goto(0,-10) pendown() pencolor('red') flower() penup() goto(-50,-20) pendown() flower() penup() goto(50,-20) pendown() flower() penup() goto(0,40) pendown() flower() penup() goto(-50,25) pendown() flower() penup() goto(50,25) pendown() flower() penup() goto(10,0) pendown() pencolor('green') goto(10,-35) penup() goto(-33,-7) pendown() goto(0,-35) penup() goto(53,-6) pendown() goto(20,-35) penup() goto(-32,39) pendown() goto(5,-35) penup() goto(54,39) pendown() goto(15,-35) penup() goto(10,50) pendown() goto(10,20) penup() #vase rects = [ (150,145,40,100,(254,163,71))] for r in rects: fill_rect(*r) fillEllipsis(174,185, 3, 6, 4, 3,(253,108,158)) fillEllipsis(164,185, 6, 3, 4, 3,(253,108,158))