Guest User

Untitled

a guest
Feb 21st, 2018
52
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.40 KB | None | 0 0
  1. # A quick desktop background thing using Nodebox and Kuler.
  2. # Requires the Nodebox 'web' plugin.
  3.  
  4. size (1680, 1050)
  5. gridSize = 10
  6.  
  7. # Color Scheme taken from Kuler - "Aspirin C"
  8. ximport ("web")
  9. colors, themes = [], web.kuler.search_by_id (251864)
  10. for r, g, b in themes[0]:
  11. colors += [color (r, g, b)]
  12.  
  13. # Cocoa drop shadow stuff, from the Nodebox tutorial
  14.  
  15. from AppKit import NSShadow, NSColor
  16. from nodebox.graphics import Grob
  17.  
  18. class shadow(Grob):
  19. def __init__(self, x=10, y=10, alpha=0.25, blur=4.0):
  20. Grob.__init__(self, _ctx)
  21. self._shadow = NSShadow.alloc().init()
  22. self._shadow.setShadowOffset_((x, -y))
  23. self._shadow.setShadowColor_(color(0, 0, 0, alpha)._rgb)
  24. self._shadow.setShadowBlurRadius_(blur)
  25. self.draw()
  26. def _draw(self):
  27. self._shadow.set()
  28.  
  29. def noshadow():
  30. shadow(alpha=0)
  31.  
  32. shadow (x = 25, y = 25, blur = 10.0)
  33.  
  34. # Rough Grid, adapted from the Nodebox tutorial
  35.  
  36. for x, y in grid(WIDTH/gridSize, HEIGHT/gridSize, gridSize, gridSize):
  37. s = random()*gridSize
  38. fill(choice (colors))
  39. oval(x, y, s, s)
  40. deltaX = (random()-0.5)*100
  41. deltaY = (random()-0.5)*100
  42. deltaS = (random()-0.5)*100
  43. fill(choice (colors))
  44. oval (x + deltaX, y + deltaY, s + deltaS, s + deltaS)
  45.  
  46. # A semitransparent shelf for your desktop icons, if desired
  47.  
  48. # fill (0, 0.5)
  49. # rect (1680-500, 0, 500, 1050)
Add Comment
Please, Sign In to add comment