Daniel Pope avatar Daniel Pope committed 9436bf4

New: allow module to be importable

Comments (0)

Files changed (1)

fractal/surface.py

         return im
 
 
-SIZE = 512
-landscape = Surface(256, fill=-0.25)
+if __name__ == '__main__':
+    SIZE = 512
+    landscape = Surface(256, fill=-0.25)
 
-for i in range(4):
-    d = 25 * i + 20
-    c = Surface.make_cone(d, (i + 1) * 0.2)
-    sys.stdout.write('.')
-    sys.stdout.flush()
-    for i in range(100 * (5 - i)):
-        landscape.blit(c, random.randint(-d, SIZE), random.randint(-d, SIZE))
-print
+    for i in range(4):
+        d = 25 * i + 20
+        c = Surface.make_cone(d, (i + 1) * 0.2)
+        sys.stdout.write('.')
+        sys.stdout.flush()
+        for i in range(100 * (5 - i)):
+            landscape.blit(c, random.randint(-d, SIZE), random.randint(-d, SIZE))
+    print
 
-landscape.to_pil().save('out.png')
-os.system('gnome-open out.png')
+    landscape.to_pil().save('out.png')
+    os.system('gnome-open out.png')
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.