Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import nodebox.graphics.context as nbc
- import nodebox.graphics as nbg
- from drawFunctions import grid
- GRID_SPACING = 10
- SCREEN_WIDTH = 500
- SCREEN_HEIGHT = 400
- class Application( object ):
- def __init__( self, width=500, height=500, gridSpacing=10 ):
- self.width = width
- self.height = height
- self.gridSpacing = gridSpacing
- self.canvas = nbc.Canvas( self.width, self.height )
- self.drawFns = self.getDrawFunctions()
- def draw( canvas ):
- canvas.clear()
- nbg.rect( 0, 0, canvas.width, canvas.height )
- grid( width, height, self.gridSpacing, (0.25, 0.25, 0.25, 1) )
- if 'f5' in canvas.keys:
- self.drawFns = self.getDrawFunctions()
- for drawFn in self.drawFns:
- drawFn()
- self.canvas.run( draw )
- def getDrawFunctions( self ):
- return []
- if __name__ == '__main__':
- Application( SCREEN_WIDTH, SCREEN_HEIGHT, GRID_SPACING )
Add Comment
Please, Sign In to add comment