From 0357e4848fc24c9956fc7d47ed7b117b4ae0737e Mon Sep 17 00:00:00 2001 From: Rnhmjoj Date: Mon, 8 Jul 2013 01:41:34 +0200 Subject: [PATCH] Correzioni MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Sistemati errori di gioventù. --- Esempio.py | 2 +- Frattali.py | 21 +++++++++++++-------- 2 files changed, 14 insertions(+), 9 deletions(-) diff --git a/Esempio.py b/Esempio.py index 0374020..0c43513 100644 --- a/Esempio.py +++ b/Esempio.py @@ -1,4 +1,4 @@ -import frattali, turtle +import turtle, frattali frattali.impostazioni() diff --git a/Frattali.py b/Frattali.py index 242538b..5cf2279 100644 --- a/Frattali.py +++ b/Frattali.py @@ -26,7 +26,8 @@ class koch(frattale): def disegna(self, l=3, s=250, n=4, p=1): spigolo = 2 * s * math.sin(math.pi/l) self.posizione(s,0) - if self.riempi == True: self.begin_fill() + if self.riempi == True: + self.begin_fill() self.rt(180 - (90 * (l-2) / l)) for i in range(l): self.curva(spigolo, n, p) @@ -51,9 +52,11 @@ class hilbert(frattale): def disegna(self, s=4, n=6, p=1): self.posizione(-33*s*p,-33*s*p) - if self.riempi == True: self.begin_fill() + if self.riempi == True: + self.begin_fill() self.curva(s, n, p) - if self.riempi == True: self.end_fill() + if self.riempi == True: + self.end_fill() self.posizione(0,0) def curva(self, s, n, p): @@ -76,12 +79,14 @@ class sierpinski(frattale): def disegna(self, n, s=400, x=-200, y=-150): self.posizione(x, y) if n==1: - if self.riempi == True: self.begin_fill() + if self.riempi == True: + self.begin_fill() for i in range(3): self.fd(s) self.lt(120) - if self.riempi == True: self.end_fill() + if self.riempi == True: + self.end_fill() else: - sierpinski.disegna(self, n-1, s/2, x, y) - sierpinski.disegna(self, n-1, s/2, x+s/2, y) - sierpinski.disegna(self, n-1, s/2, x+s/4, y+(s*((3)**0.5))/4) + self.disegna(n-1, s/2, x, y) + self.disegna(n-1, s/2, x+s/2, y) + self.disegna(n-1, s/2, x+s/4, y+(s*((3)**0.5))/4)