Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--talogo.py4
-rw-r--r--taturtle.py13
2 files changed, 11 insertions, 6 deletions
diff --git a/talogo.py b/talogo.py
index be611fe..892993a 100644
--- a/talogo.py
+++ b/talogo.py
@@ -95,6 +95,8 @@ def blocks_to_code(lc,spr):
code.append(float(ord(spr.label[0])))
elif spr.proto.name=='string' or spr.proto.name=='title':
if type(spr.label) == float or type(spr.label) == int:
+ #if int(spr.label) == spr.label:
+ # spr.label = int(spr.label)
code.append('#s'+str(spr.label))
else:
code.append('#s'+spr.label)
@@ -858,7 +860,7 @@ def show(lc, string):
play_sound(lc, string)
else:
draw_text(lc.tw.turtle,string,x,y,lc.tw.textsize,lc.tw.turtle.width)
- elif type(string) == float:
+ elif type(string) == float or type(string) == int:
if int(string) == string:
string = int(string)
else:
diff --git a/taturtle.py b/taturtle.py
index 9479c97..f3d408a 100644
--- a/taturtle.py
+++ b/taturtle.py
@@ -254,13 +254,16 @@ def draw_text(t, label, x, y, size, w):
pass
if type(label) == str or type(label) == unicode:
pl = t.tw.window.create_pango_layout(label.replace("\0"," "))
- pl.set_font_description(fd)
- pl.set_width(int(w)*pango.SCALE)
- t.canvas.image.draw_layout(t.gc,int(x),int(y),pl)
- w,h = pl.get_pixel_size()
- invalt(t,x,y,w,h)
+ elif type(label) == float or type(label) == int:
+ pl = t.tw.window.create_pango_layout(str(label))
else:
print type(label)
+ pl.set_font_description(fd)
+ pl.set_width(int(w)*pango.SCALE)
+ t.canvas.image.draw_layout(t.gc,int(x),int(y),pl)
+ w,h = pl.get_pixel_size()
+ invalt(t,x,y,w,h)
+
def draw_line(t,x1,y1,x2,y2):
x1,y1 = t.width/2+int(x1), t.height/2-int(y1)