From 2c2edff8980c84a8fcaecac790788fc35c857392 Mon Sep 17 00:00:00 2001 From: Walter Bender Date: Thu, 28 Jan 2010 21:10:44 +0000 Subject: updated license; tamyblock --- diff --git a/constants.py b/constants.py index b415f1c..83f6433 100644 --- a/constants.py +++ b/constants.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -#Copyright (c) 2009, Walter Bender +#Copyright (c) 2010, Walter Bender # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by diff --git a/tacanvas.py b/tacanvas.py index 3d03b6f..4d9dd76 100644 --- a/tacanvas.py +++ b/tacanvas.py @@ -1,5 +1,5 @@ #Copyright (c) 2007-8, Playful Invention Company. -#Copyright (c) 2008-9, Walter Bender +#Copyright (c) 2008-10, Walter Bender #Permission is hereby granted, free of charge, to any person obtaining a copy #of this software and associated documentation files (the "Software"), to deal diff --git a/tajail.py b/tajail.py index 014ddad..10ec9d9 100644 --- a/tajail.py +++ b/tajail.py @@ -1,4 +1,4 @@ -#Copyright (c) 2009, Walter Bender (on behalf of Sugar Labs) +#Copyright (c) 2009-10, Walter Bender (on behalf of Sugar Labs) #Permission is hereby granted, free of charge, to any person obtaining a copy #of this software and associated documentation files (the "Software"), to deal @@ -18,12 +18,12 @@ #OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN #THE SOFTWARE. -# a naive approach to running myfun in a jail +# A naive approach to running myfunc in a jail from time import * from math import * try: from numpy import * -except: +except ImportError: pass from tacanvas import * @@ -39,7 +39,6 @@ def myfunc(lc, f, x): def myfunc_import(lc, f, x): userdefined = {} - print f exec f in globals(), userdefined return userdefined['myblock'](lc,x) diff --git a/talogo.py b/talogo.py index 32867e9..f45f0e0 100644 --- a/talogo.py +++ b/talogo.py @@ -1,5 +1,6 @@ #Copyright (c) 2007-8, Playful Invention Company. -#Copyright (c) 2008-9, Walter Bender +#Copyright (c) 2008-10, Walter Bender +#Copyright (c) 2008-10, Raúl Gutiérrez Segalés #Permission is hereby granted, free of charge, to any person obtaining a copy #of this software and associated documentation files (the "Software"), to deal diff --git a/tamyblock.py b/tamyblock.py index dca0bf8..3336978 100644 --- a/tamyblock.py +++ b/tamyblock.py @@ -1,4 +1,4 @@ -#Copyright (c) 2009, Walter Bender +#Copyright (c) 2009-10, Walter Bender #Permission is hereby granted, free of charge, to any person obtaining a copy #of this software and associated documentation files (the "Software"), to deal @@ -36,21 +36,21 @@ def myblock(lc,x): try: # make sure x is a number x = float(x) - except: + except ValueError: return - pen = lc.tw.turtle.pendown # save current turtle pen state + pen = lc.tw.canvas.pendown # save current turtle pen state dist = 0 - while dist+lc.tw.turtle.pensize < x: # repeat drawing dots - setpen(lc.tw.turtle, True) - forward(lc.tw.turtle, 1) - setpen(lc.tw.turtle, False) - forward(lc.tw.turtle, (lc.tw.turtle.pensize*2)-1) - dist += (lc.tw.turtle.pensize*2) - forward(lc.tw.turtle, x-dist) # make sure we have moved x - - setpen(lc.tw.turtle, pen) # restore pen state + while dist+lc.tw.canvas.pensize < x: # repeat drawing dots + lc.tw.canvas.setpen(True) + lc.tw.canvas.forward(1) + lc.tw.canvas.setpen(False) + lc.tw.canvas.forward((lc.tw.canvas.pensize*2)-1) + dist += (lc.tw.canvas.pensize*2) + lc.tw.canvas.forward(x-dist) # make sure we have moved x + + lc.tw.canvas.setpen(pen) # restore pen state ########################################################################### diff --git a/taproject.py b/taproject.py index a270c6e..562fbf9 100644 --- a/taproject.py +++ b/taproject.py @@ -1,5 +1,5 @@ #Copyright (c) 2007-8, Playful Invention Company. -#Copyright (c) 2008-9, Walter Bender +#Copyright (c) 2008-10, Walter Bender #Permission is hereby granted, free of charge, to any person obtaining a copy #of this software and associated documentation files (the "Software"), to deal diff --git a/tawindow.py b/tawindow.py index b921d8a..8eb2fce 100644 --- a/tawindow.py +++ b/tawindow.py @@ -1,7 +1,7 @@ # -*- coding: utf-8 -*- #Copyright (c) 2007, Playful Invention Company -#Copyright (c) 2008-9, Walter Bender -#Copyright (c) 2009, Raúl Gutiérrez Segalés +#Copyright (c) 2008-10, Walter Bender +#Copyright (c) 2009-10 Raúl Gutiérrez Segalés #Permission is hereby granted, free of charge, to any person obtaining a copy #of this software and associated documentation files (the "Software"), to deal diff --git a/turtleart.py b/turtleart.py index b90eecf..f1a3218 100755 --- a/turtleart.py +++ b/turtleart.py @@ -1,6 +1,6 @@ #!/usr/bin/env python #Copyright (c) 2007-8, Playful Invention Company -#Copyright (c) 2008-9, Walter Bender +#Copyright (c) 2008-10, Walter Bender #Permission is hereby granted, free of charge, to any person obtaining a copy #of this software and associated documentation files (the "Software"), to deal -- cgit v0.9.1