Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
path: root/TurtleArt/tautils.py
diff options
context:
space:
mode:
authorWalter Bender <walter@sugarlabs.org>2010-09-17 15:43:39 (GMT)
committer Walter Bender <walter@sugarlabs.org>2010-09-17 15:43:39 (GMT)
commita70753dd5b92f6fa519170c484208091b634a7cf (patch)
tree61ed99c9114e8224e40b4635f90c6d4df72b3fff /TurtleArt/tautils.py
parentc9b680edd252689d52b5d2c6e002fee07cd5d3a2 (diff)
more robust hit detection for hide/show buttons
Diffstat (limited to 'TurtleArt/tautils.py')
-rw-r--r--TurtleArt/tautils.py9
1 files changed, 6 insertions, 3 deletions
diff --git a/TurtleArt/tautils.py b/TurtleArt/tautils.py
index 9813a30..1466946 100644
--- a/TurtleArt/tautils.py
+++ b/TurtleArt/tautils.py
@@ -36,7 +36,8 @@ except (ImportError, AttributeError):
except:
OLD_SUGAR_SYSTEM = True
from taconstants import STRING_OR_NUMBER_ARGS, HIDE_LAYER, CONTENT_ARGS, \
- COLLAPSIBLE, BLOCK_LAYER, CONTENT_BLOCKS
+ COLLAPSIBLE, BLOCK_LAYER, CONTENT_BLOCKS, HIT_HIDE, \
+ HIT_SHOW
from StringIO import StringIO
import os.path
from gettext import gettext as _
@@ -507,7 +508,8 @@ def collapsible(blk):
def hide_button_hit(spr, x, y):
""" Did the sprite's hide (contract) button get hit? """
_red, _green, _blue, _alpha = spr.get_pixel((x, y))
- if (_red == 255 and _green == 0) or _green == 255:
+ print _red, _green, _blue
+ if _red == HIT_HIDE:
return True
else:
return False
@@ -515,7 +517,8 @@ def hide_button_hit(spr, x, y):
def show_button_hit(spr, x, y):
""" Did the sprite's show (expand) button get hit? """
_red, _green, _blue, _alpha = spr.get_pixel((x, y))
- if _green == 254:
+ print _red, _green, _blue
+ if _green == HIT_SHOW:
return True
else:
return False