Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--TurtleArt/talogo.py15
1 files changed, 12 insertions, 3 deletions
diff --git a/TurtleArt/talogo.py b/TurtleArt/talogo.py
index f3bb956..0e28cf0 100644
--- a/TurtleArt/talogo.py
+++ b/TurtleArt/talogo.py
@@ -561,7 +561,8 @@ class LogoCode:
""" height as a percentage of screen coordinates """
return int((self.tw.canvas.height * self.scale) / 100.)
- def insert_image(self, center=False, filepath=None):
+ def insert_image(self, center=False, filepath=None, resize=True,
+ offset=False):
""" Image only (at current x, y) """
if filepath is not None:
self.filepath = filepath
@@ -579,8 +580,13 @@ class LogoCode:
self.filepath is not None and \
self.filepath != '':
try:
- pixbuf = gtk.gdk.pixbuf_new_from_file_at_size(self.filepath,
- w, h)
+ if not resize:
+ pixbuf = gtk.gdk.pixbuf_new_from_file(self.filepath)
+ w = pixbuf.get_width()
+ h = pixbuf.get_height()
+ else:
+ pixbuf = gtk.gdk.pixbuf_new_from_file_at_size(
+ self.filepath, w, h)
except:
self.tw.showlabel('nojournal', self.filepath)
debug_output("Couldn't open filepath %s" % (self.filepath),
@@ -595,6 +601,9 @@ class LogoCode:
self.x2tx() - int(w / 2),
self.y2ty() - int(h / 2), w, h,
self.filepath)
+ elif offset:
+ self.tw.canvas.draw_pixbuf(pixbuf, 0, 0, self.x2tx(),
+ self.y2ty() - h, w, h, self.filepath)
else:
self.tw.canvas.draw_pixbuf(pixbuf, 0, 0,
self.x2tx(),