def __init__(self, canvas, x, y, image, anchor=gtk.ANCHOR_NW, group=None): _CanvasItem.__init__(self, canvas) self._x, self._y = x, y if isinstance(anchor, str): anchor = anchor_tk2gtk(anchor) if group: self._group = group group = group._item else: group = canvas.root() self._item = group.add(gnomecanvas.CanvasPixbuf, x=x, y=y, pixbuf=image.pixbuf, width=image.width(), height=image.height(), anchor=anchor) self._item.show()
def __init__(self, canvas, x, y, anchor=gtk.ANCHOR_NW, preview=-1, **kw): _CanvasItem.__init__(self, canvas) self._x, self._y = x, y if preview < 0: preview = canvas.preview if preview > 1: self._item = None return anchor = anchor_tk2gtk(anchor) if 'group' in kw: self._group = kw['group'] group = kw['group']._item del kw['group'] else: group = canvas.root() self._item = group.add(gnomecanvas.CanvasText, x=x, y=y, anchor=anchor) if 'fill' not in kw: kw['fill'] = canvas._text_color for k, v in kw.items(): self[k] = v # ~ self.text_format = None canvas._text_items.append(self) self._item.show()
def __init__(self, canvas, x, y, anchor=gtk.ANCHOR_NW, preview=-1, **kw): _CanvasItem.__init__(self, canvas) self._x, self._y = x, y if preview < 0: preview = canvas.preview if preview > 1: self._item = None return anchor = anchor_tk2gtk(anchor) if 'group' in kw: self._group = kw['group'] group = kw['group']._item del kw['group'] else: group = canvas.root() self._item = group.add(gnomecanvas.CanvasText, x=x, y=y, anchor=anchor) if 'fill' not in kw: kw['fill'] = canvas._text_color for k, v in kw.items(): self[k] = v ##~ self.text_format = None canvas._text_items.append(self) self._item.show()