Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # A quick desktop background thing using Nodebox and Kuler.
- # Requires the Nodebox 'web' plugin.
- size (1680, 1050)
- gridSize = 10
- # Color Scheme taken from Kuler - "Aspirin C"
- ximport ("web")
- colors, themes = [], web.kuler.search_by_id (251864)
- for r, g, b in themes[0]:
- colors += [color (r, g, b)]
- # Cocoa drop shadow stuff, from the Nodebox tutorial
- from AppKit import NSShadow, NSColor
- from nodebox.graphics import Grob
- class shadow(Grob):
- def __init__(self, x=10, y=10, alpha=0.25, blur=4.0):
- Grob.__init__(self, _ctx)
- self._shadow = NSShadow.alloc().init()
- self._shadow.setShadowOffset_((x, -y))
- self._shadow.setShadowColor_(color(0, 0, 0, alpha)._rgb)
- self._shadow.setShadowBlurRadius_(blur)
- self.draw()
- def _draw(self):
- self._shadow.set()
- def noshadow():
- shadow(alpha=0)
- shadow (x = 25, y = 25, blur = 10.0)
- # Rough Grid, adapted from the Nodebox tutorial
- for x, y in grid(WIDTH/gridSize, HEIGHT/gridSize, gridSize, gridSize):
- s = random()*gridSize
- fill(choice (colors))
- oval(x, y, s, s)
- deltaX = (random()-0.5)*100
- deltaY = (random()-0.5)*100
- deltaS = (random()-0.5)*100
- fill(choice (colors))
- oval (x + deltaX, y + deltaY, s + deltaS, s + deltaS)
- # A semitransparent shelf for your desktop icons, if desired
- # fill (0, 0.5)
- # rect (1680-500, 0, 500, 1050)
Add Comment
Please, Sign In to add comment