I need to display some text in a given rectangle. If the text is too long, the text should be trunctated and '...' appended to what is displayed.
Example: I need to display 'qwertyuiop' but it's too long, so I display only 'qwer...'.
In the present I am using something like this:
def set_layout_label(self, layout, label, max_width):
layout.set_text(label)
width, height = layout.get_pixel_size()
i = -3
while width > max_width:
label0 = label[:i] + '...'
layout.set_text(label0)
width, height = layout.get_pixel_size()
i -= 1
return layoutwhere layout is a pango layout.
Is there a predefined method/function that does this ? Is there another simpler/faster way to set the pango text ?
TIA,
Ionutz
_______________________________________________ pygtk mailing list [EMAIL PROTECTED] http://www.daa.com.au/mailman/listinfo/pygtk Read the PyGTK FAQ: http://www.async.com.br/faq/pygtk/
