Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
path: root/TurtleArt
diff options
context:
space:
mode:
Diffstat (limited to 'TurtleArt')
-rw-r--r--TurtleArt/tajail.py8
1 files changed, 7 insertions, 1 deletions
diff --git a/TurtleArt/tajail.py b/TurtleArt/tajail.py
index c8cea7f..3fcf997 100644
--- a/TurtleArt/tajail.py
+++ b/TurtleArt/tajail.py
@@ -25,6 +25,7 @@ from math import *
def myfunc(f, args):
+ ''' Run inline Python code '''
# check to make sure no import calls are made
if len(args) == 1:
myf = 'def f(x): return ' + f.replace('import', '')
@@ -44,10 +45,15 @@ def myfunc(f, args):
def myfunc_import(parent, f, x):
+ ''' Run Python code imported from Journal '''
+ if 'def myblock(lc,' in f:
+ base_class = parent.tw.lc # pre-v107, we passed lc
+ else:
+ base_class = parent.tw # as of v107, we pass tw
userdefined = {}
try:
exec f in globals(), userdefined
- return userdefined['myblock'](parent.tw, x)
+ return userdefined['myblock'](base_class, x)
except:
traceback.print_exc()
return None