Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
path: root/talogo.py
diff options
context:
space:
mode:
authorWalter Bender <walter@walter-laptop.(none)>2009-10-17 14:36:46 (GMT)
committer Walter Bender <walter@walter-laptop.(none)>2009-10-17 14:36:46 (GMT)
commit84a9eecceca98a9df6f429ecb8d06c749ef292eb (patch)
tree48d8021969435473430aeb6e502adc144902c942 /talogo.py
parent5463687e5e8a07a22f2f93e1f03c4982a2c7b22c (diff)
display coordinates
Diffstat (limited to 'talogo.py')
-rw-r--r--talogo.py29
1 files changed, 25 insertions, 4 deletions
diff --git a/talogo.py b/talogo.py
index a49b3f9..3693ba9 100644
--- a/talogo.py
+++ b/talogo.py
@@ -189,6 +189,7 @@ def evline(lc, list):
raise logoerror(str(lc.iresult))
lc.iline = oldiline
ireturn(lc)
+ display_coordinates(lc.tw)
yield True
def eval(lc, infixarg=False):
@@ -247,15 +248,16 @@ def infixnext(lc):
def debug_trace(lc, token):
if lc.trace:
- if token.name in ['forward', 'right', 'back', 'left', 'seth', 'setxy', 'arc', \
- 'heading', 'xcor', 'ycor']:
+ if token.name in ['forward', 'right', 'back', 'left', 'seth', 'setxy', \
+ 'arc', 'heading', 'xcor', 'ycor']:
my_string = token.name +\
"\nxcor= " + str(int(lc.tw.turtle.xcor)) +\
"\nycor= " + str(int(lc.tw.turtle.ycor)) +\
"\nheading= " + str(int(lc.tw.turtle.heading)) +\
"\nscale= " + str(lc.scale)
- elif token.name in ['penup', 'pendown', 'setcolor', 'setshade', 'fillscreen',\
- 'settextcolor', 'settextsize', 'shade', 'color', 'pensize']:
+ elif token.name in ['penup', 'pendown', 'setcolor', 'setshade', \
+ 'settextcolor', 'settextsize', 'shade', 'color', \
+ 'fillscreen', 'pensize']:
if lc.tw.turtle.pendown:
penstatus = "\npen down"
else:
@@ -593,6 +595,25 @@ def lcNew(tw):
return lc
+def display_coordinates(tw):
+ if hasattr(tw, "activity"):
+ if hasattr(tw.activity, "coordinates_label"):
+ x = tw.turtle.xcor
+ if int(float(x)) == x:
+ xx = int(x)
+ else:
+ xx = int(float(x)*10)/10.
+ y = tw.turtle.ycor
+ if int(float(y)) == y:
+ yy = int(y)
+ else:
+ yy = int(float(y)*10)/10.
+ # print _("(x,y): ") + "(" + str(xx) + "," + str(yy) + ")"
+ tw.activity.coordinates_label.set_text(_("(x,y): ") + "(" + \
+ str(xx) + "," + \
+ str(yy) + ")")
+ tw.activity.coordinates_label.show()
+
def box(lc,x):
try:
return lc.boxes['box3'+str(x)]