Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
path: root/plugins/turtle_blocks_extras/turtle_blocks_extras.py
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/turtle_blocks_extras/turtle_blocks_extras.py')
-rw-r--r--plugins/turtle_blocks_extras/turtle_blocks_extras.py21
1 files changed, 20 insertions, 1 deletions
diff --git a/plugins/turtle_blocks_extras/turtle_blocks_extras.py b/plugins/turtle_blocks_extras/turtle_blocks_extras.py
index 92f9c26..f3b0d8f 100644
--- a/plugins/turtle_blocks_extras/turtle_blocks_extras.py
+++ b/plugins/turtle_blocks_extras/turtle_blocks_extras.py
@@ -108,7 +108,7 @@ class Turtle_blocks_extras(Plugin):
boolean operators from Numbers palette'))
# internally expanded macro
- palette.add_block('until',
+ palette.add_block('until',
style='clamp-style-boolean',
label=_('until'),
prim_name='until',
@@ -331,6 +331,7 @@ amplitude, and duration (in seconds)'))
primitive_dictionary['mousebutton'] = self._prim_mouse_button
palette.add_block('mousebutton',
+ hidden=True,
style='box-style',
label=_('button down'),
prim_name='mousebutton',
@@ -340,6 +341,17 @@ pressed'))
self.tw.lc.def_prim('mousebutton', 0,
lambda self: primitive_dictionary['mousebutton']())
+ primitive_dictionary['mousebutton2'] = self._prim_mouse_button_bool
+ palette.add_block('mousebutton2',
+ style='boolean-block-style',
+ label=_('button down'),
+ prim_name='mousebutton2',
+ value_block=True,
+ help_string=_('returns True if mouse button is \
+pressed'))
+ self.tw.lc.def_prim('mousebutton2', 0,
+ lambda self: primitive_dictionary['mousebutton2']())
+
palette.add_block('mousex',
style='box-style',
label=_('mouse x'),
@@ -1320,6 +1332,13 @@ bullets'))
else:
return 0
+ def _prim_mouse_button_bool(self):
+ """ Return True if mouse button is pressed """
+ if self.tw.mouse_flag == 1:
+ return True
+ else:
+ return False
+
def _prim_see(self):
""" Read r, g, b from the canvas and return a corresponding palette
color """