Commits

Brendan Howell  committed 603b9f8

fixes #12 as well as a few newly introduced type scaling bugs. cleaned up some examples

  • Participants
  • Parent commits 45c59b3
  • Tags v0.3.1

Comments (0)

Files changed (7)

File pycessing/data/examples/lists-particles.cess

 # Drawing on a coordinate list
+import random
 
 coords = [ (20, 20),
            (50, 50),
            (80, 90),
            (123, 231),
-           (100, 100) ]
+           (100, 100) ]
+           
+for x in range(100):
+    newcoord = (random.randint(1,300), random.randint(1, 200))
+    coords.append(newcoord)
            
 def setup():
     pycessing.noLoop = True
     
 def draw():
     for coordinate in coords:
-        circle( coordinate[0], coordinate[1], 10 )
+        circle( coordinate[0], coordinate[1], 5 )

File pycessing/data/examples/love-poetry-machine.cess

-# love letter machine
+# love letter machine
+#
+# - generates a new love letter with each keypress
 
 import random
 
 
 def lovePoem(event):
     global y
-    y =45
+    y = 60
     
     setBackground(127,127,127)
     txt = random.choice(greeting) + ","
         
         myText.setText(txt)
         myText.draw(15, y)
-        y = y + 40
+        y = y + 50
         
     txt = "Yours " + random.choice(adverbs) + ", MUC"
     myText.setText(txt)
     
           
 def setup():
-    pycessing.size(700, 300)
-    #pycessing.noLoop = True
+    pycessing.size(700, 400)
     pycessing.onKeyDown = lovePoem
           
 def draw():

File pycessing/data/examples/text-wrapped.cess

 	
 def draw():
     myText.setText(text)
-    myText.draw_wrapped(10,20, 300)
+    myText.draw(10,20, 300)
 

File pycessing/data/examples/twitter-search.cess

 import json
 import urllib2
 
-
 mytext = ScreenText(size=15)
 results = {}
 searchterm = "hats"
    
     
 def draw():
-    ypos = 10
+    ypos = 10
+    txts = ""
+    
     for result in results["results"]:
-        mytext.setText(result["text"].strip())
-        print result["text"]
-        mytext.draw(10,ypos)
-        ypos += 30
+        txts += result["text"].strip() + u"\n\n"
+        print result["text"]
+        
+    mytext.setText(txts)
+    mytext.draw(10, 10, 780)

File pycessing/data/examples/wrapping-paper-squares.cess

 #this generates a pretty pantone-looking grid of colored squares
 #slowly changing color and value
+#
+# I once used it to create wrapping paper for gifts.  It was quicker
+# and cooler than going to the store.  -Brendan
 
 width = 1024
 height = 768

File pycessing/drawing_cairo.py

         self.ctx.curve_to(cx1, cy1, cx2, cy2, x2, y2)
         self._fillAndStroke()
 
+    #TODO: this is broken under cairo
     def screenGrab(self, fileName):
         pygame.image.save(self.sdl_surface, fileName)
 

File pycessing/typo.py

         DRAWING.ctx.set_source_rgba(r, g, b, a)
         layout = DRAWING.pangoctx.create_layout()
         layout.set_font_description(pango.FontDescription(self.fontName + " " + str(self.size)))
-        layout.set_width(width)
+        layout.set_width(width * pango.SCALE)
         layout.set_text(self.text)
         DRAWING.pangoctx.update_layout(layout)
         DRAWING.pangoctx.show_layout(layout)