Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
path: root/pysamples/load_block.py
diff options
context:
space:
mode:
authorRaul Gutierrez Segales <raul.gutierrez.segales@collabora.co.uk>2011-02-27 23:54:26 (GMT)
committer Raul Gutierrez Segales <raul.gutierrez.segales@collabora.co.uk>2011-02-27 23:54:26 (GMT)
commitf8c9a80737599196872bd4bb7bd42e208cf6274e (patch)
tree44b397526d7efca502cd5fdd1f5f399917db6695 /pysamples/load_block.py
parent82ab0c3f73213e82ca94c08c26da2ffa7556e55b (diff)
Avoid computing the x and y twice
Diffstat (limited to 'pysamples/load_block.py')
-rw-r--r--pysamples/load_block.py6
1 files changed, 4 insertions, 2 deletions
diff --git a/pysamples/load_block.py b/pysamples/load_block.py
index 566ed47..4f46a73 100644
--- a/pysamples/load_block.py
+++ b/pysamples/load_block.py
@@ -35,11 +35,13 @@ def myblock(lc, blkname):
from tautils import find_group
def make_block(lc, name, x, y, defaults):
- lc.tw._new_block(name, x + 20, y + 20, defaults)
+ x_pos = x + 20
+ y_pos = y + 20
+ lc.tw._new_block(name, x_pos, y_pos, defaults)
# Find the block we just created and attach it to a stack.
lc.tw.drag_group = None
- spr = lc.tw.sprite_list.find_sprite((x + 20, y + 20))
+ spr = lc.tw.sprite_list.find_sprite((x_pos, y_pos))
if spr is not None:
blk = lc.tw.block_list.spr_to_block(spr)
if blk is not None: