Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
path: root/TurtleArt/tautils.py
diff options
context:
space:
mode:
Diffstat (limited to 'TurtleArt/tautils.py')
-rw-r--r--TurtleArt/tautils.py20
1 files changed, 20 insertions, 0 deletions
diff --git a/TurtleArt/tautils.py b/TurtleArt/tautils.py
index 8e37f95..c53d8cc 100644
--- a/TurtleArt/tautils.py
+++ b/TurtleArt/tautils.py
@@ -803,6 +803,26 @@ def find_blk_below(blk, namelist):
return None
+def get_stack_width_and_height(blk):
+ ''' What are the width and height of a stack? '''
+ minx = 10000
+ miny = 10000
+ maxx = -10000
+ maxy = -10000
+ for gblk in find_group(blk):
+ (x, y) = gblk.spr.get_xy()
+ w, h = gblk.spr.get_dimensions()
+ if x < minx:
+ minx = x
+ if y < miny:
+ miny = y
+ if x + w > maxx:
+ maxx = x + w
+ if y + h > maxy:
+ maxy = y + h
+ return(maxx - minx, maxy - miny)
+
+
def get_stack_name(blk):
''' Return the name of the action stack that the given block belongs to.
If the top block of this stack is not a stack-defining block, return