Ok, I found a solution. Here's what I did:
tv = self.textview
context = tv.get_pango_context()
metrics = context.get_metrics(tv.style.font_desc,
context.get_language())
width = pango.PIXELS(metrics.get_approximate_digit_width()*81)
height = pango.PIXELS(
(metrics.get_ascent() + metrics.get_descent())*30)
self.window_main.set_default_size(width, height)
Have a good day,
Noam
2008/8/31, Noam Raphael <[EMAIL PROTECTED]>:
> Hello,
>
> I have a TextView which uses a monospace font. I would like to set its
> width (by using textview.props.width_request = width) to the width of
> 80 characters. The question is, how can I know the width and height,
> in pixels, of a character?
>
> Thanks,
>
> Noam
>
_______________________________________________
pygtk mailing list [email protected]
http://www.daa.com.au/mailman/listinfo/pygtk
Read the PyGTK FAQ: http://www.async.com.br/faq/pygtk/