diff options
Diffstat (limited to 'playtile.py')
-rw-r--r-- | playtile.py | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/playtile.py b/playtile.py index fd56e4d..e3c2494 100644 --- a/playtile.py +++ b/playtile.py @@ -3,18 +3,19 @@ import hippo import math import os -from sugar.graphics import font from sugar.graphics import units class PlayTile(hippo.CanvasBox, hippo.CanvasItem): __gtype_name__ = 'PlayTile' _BORDER_DEFAULT = units.points_to_pixels(1.0) - def __init__(self, num, **kargs): + def __init__(self, num, x, y, **kargs): hippo.CanvasBox.__init__(self, **kargs) self.num = num self.image = os.path.join(os.path.dirname(__file__), 'images/black.png') + self.scale_x = x + self.scale_y = y self._radius = units.points_to_pixels(5) self.props.border_color = 100 @@ -53,10 +54,11 @@ class PlayTile(hippo.CanvasBox, hippo.CanvasItem): hbox.props.spacing = units.points_to_pixels(5) hbox.props.padding_top = units.points_to_pixels(5) hbox.props.padding_bottom = units.points_to_pixels(5) - + self.img_widget = gtk.Image() - self.img_pixbuf = gtk.gdk.pixbuf_new_from_file(self.image) - self.img_widget.set_from_pixbuf(self.img_pixbuf) + pixbuf_i = gtk.gdk.pixbuf_new_from_file(self.image) + self.scaledbuf_i = pixbuf_i.scale_simple(self.scale_x, self.scale_y, gtk.gdk.INTERP_BILINEAR) + self.img_widget.set_from_pixbuf(self.scaledbuf_i) canvas_widget = hippo.CanvasWidget() canvas_widget.props.widget = self.img_widget |