File tree Expand file tree Collapse file tree 2 files changed +22
-1
lines changed
Expand file tree Collapse file tree 2 files changed +22
-1
lines changed Original file line number Diff line number Diff line change 11# Add the upper directory (where the nodebox module is) to the search path.
22import os , sys ; sys .path .insert (0 , os .path .join (".." , ".." ))
3+ < << << << HEAD
34import warnings
5+ == == == =
6+ >> >> >> > 2 dde5a7eb4a0f379e8d2476487011bdacba7e165
47
58from nodebox .graphics import *
69
710# Live coding example.
811# The actual drawing code is in 04-live2.py.
912# This script starts the canvas and executes the commands from 04-live2.py.
13+ < << << << HEAD
1014# You can then edit and save the code there,
1115# changes will be reflected automatically while the canvas keeps running.
16+ == == == =
17+ # You can then edit and save the code there, changes will be reflected automatically.
18+ >> >> >> > 2 dde5a7eb4a0f379e8d2476487011bdacba7e165
1219
1320SCRIPT = "04-live2.py"
1421source = open (SCRIPT ).read ()
1724def draw (canvas ):
1825 global source
1926 global modified
27+ < << << << HEAD
2028 try :
2129 exec (source )
2230 except Exception , e :
2331 warnings .warn (str (e ), Warning )
32+ == == == =
33+ exec (source )
34+ >> >> >> > 2 dde5a7eb4a0f379e8d2476487011bdacba7e165
2435 if os .path .getmtime (SCRIPT ) > modified :
2536 source = open (SCRIPT ).read ()
2637 modified = os .path .getmtime (SCRIPT )
Original file line number Diff line number Diff line change 1+ < << << << HEAD
12# Live coding example.
23# See 04-live1.py.
34# The commands below are read and executed in a canvas there.
45# If you edit and save this file, changes are automatically reflected,
56# while the canvas started in 04-live1.py keeps on running.
7+ == == == =
8+ # See 04-live1.py.
9+ # The commands below are read and executed in a canvas there.
10+ # If you edit and save this file, changes are automatically reflected.
11+ >> >> >> > 2 dde5a7eb4a0f379e8d2476487011bdacba7e165
612
713#canvas.clear()
814for i in range (10 ):
1117 r = random (20 ) + 50
1218 fill (random (), 0.0 , random (0.25 ), random (0.25 ))
1319 stroke (0 , 0.2 )
14- ellipse (x , y , random , r )
20+ < << << << HEAD
21+ ellipse (x , y , random , r )
22+ == == == =
23+ ellipse (x , y , r , r )
24+ >> >> >> > 2 dde5a7eb4a0f379e8d2476487011bdacba7e165
You can’t perform that action at this time.
0 commit comments