def __init__(self, text="", markup="", spacing=5, image=None, image_position=None, size=None, font_desc=None, overflow=False, color="#000", background_color=None, **kwargs): # TODO - am initiating table with fill = false but that yields suboptimal label placement and the 0,0 points to whatever parent gave us Bin.__init__(self, **kwargs) #: image to put next to the label self.image = image # the actual container that contains the label and/or image self.container = Box(spacing=spacing, fill=False, x_align=self.x_align, y_align=self.y_align) if image_position is not None: self.image_position = image_position self.display_label = _DisplayLabel(text=text, markup=markup, color=color, size=size) self.display_label.x_align = 0 # the default is 0.5 which makes label align incorrectly on wrapping if font_desc or self.font_desc: self.display_label.font_desc = font_desc or self.font_desc self.display_label.size = size or self.size self.background_color = background_color #: either the pango `wrap <http://www.pygtk.org/pygtk2reference/pango-constants.html#pango-wrap-mode-constants>`_ #: or `ellipsize <http://www.pygtk.org/pygtk2reference/pango-constants.html#pango-ellipsize-mode-constants>`_ constant. #: if set to False will refuse to become smaller self.overflow = overflow self.add_child(self.container) self._position_contents() self.connect_after("on-render", self.__on_render)