File tree Expand file tree Collapse file tree 2 files changed +0
-21
lines changed
Expand file tree Collapse file tree 2 files changed +0
-21
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
43import warnings
5- == == == =
6- >> >> >> > 2 dde5a7eb4a0f379e8d2476487011bdacba7e165
74
85from nodebox .graphics import *
96
107# Live coding example.
118# The actual drawing code is in 04-live2.py.
129# This script starts the canvas and executes the commands from 04-live2.py.
13- < << << << HEAD
1410# You can then edit and save the code there,
1511# 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
1912
2013SCRIPT = "04-live2.py"
2114source = open (SCRIPT ).read ()
2417def draw (canvas ):
2518 global source
2619 global modified
27- < << << << HEAD
2820 try :
2921 exec (source )
3022 except Exception , e :
3123 warnings .warn (str (e ), Warning )
32- == == == =
33- exec (source )
34- >> >> >> > 2 dde5a7eb4a0f379e8d2476487011bdacba7e165
3524 if os .path .getmtime (SCRIPT ) > modified :
3625 source = open (SCRIPT ).read ()
3726 modified = os .path .getmtime (SCRIPT )
Original file line number Diff line number Diff line change 1- < << << << HEAD
21# Live coding example.
32# See 04-live1.py.
43# The commands below are read and executed in a canvas there.
54# If you edit and save this file, changes are automatically reflected,
65# 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
126
137#canvas.clear()
148for i in range (10 ):
1711 r = random (20 ) + 50
1812 fill (random (), 0.0 , random (0.25 ), random (0.25 ))
1913 stroke (0 , 0.2 )
20- < << << << HEAD
21- ellipse (x , y , random , r )
22- == == == =
2314 ellipse (x , y , r , r )
24- >> >> >> > 2 dde5a7eb4a0f379e8d2476487011bdacba7e165
You can’t perform that action at this time.
0 commit comments