Guest User

Untitled

a guest
Oct 20th, 2018
98
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.96 KB | None | 0 0
  1. import nodebox.graphics.context as nbc
  2. import nodebox.graphics as nbg
  3.  
  4. from drawFunctions import grid
  5.  
  6.  
  7. GRID_SPACING = 10
  8. SCREEN_WIDTH = 500
  9. SCREEN_HEIGHT = 400
  10.  
  11.  
  12. class Application( object ):
  13.  
  14. def __init__( self, width=500, height=500, gridSpacing=10 ):
  15. self.width = width
  16. self.height = height
  17. self.gridSpacing = gridSpacing
  18.  
  19. self.canvas = nbc.Canvas( self.width, self.height )
  20. self.drawFns = self.getDrawFunctions()
  21.  
  22. def draw( canvas ):
  23. canvas.clear()
  24. nbg.rect( 0, 0, canvas.width, canvas.height )
  25. grid( width, height, self.gridSpacing, (0.25, 0.25, 0.25, 1) )
  26. if 'f5' in canvas.keys:
  27. self.drawFns = self.getDrawFunctions()
  28. for drawFn in self.drawFns:
  29. drawFn()
  30.  
  31. self.canvas.run( draw )
  32.  
  33. def getDrawFunctions( self ):
  34. return []
  35.  
  36.  
  37. if __name__ == '__main__':
  38. Application( SCREEN_WIDTH, SCREEN_HEIGHT, GRID_SPACING )
Add Comment
Please, Sign In to add comment