[pygtk] Getting string with in pixels

Walter Leibbrandt walter at translate.org.za
Fri Feb 13 22:46:32 WST 2009


Hi,

Vladimír Jícha wrote:
> Hello,
>
> I'm trying to get width of a text string. I found a FAQ 4.15 
> (http://faq.pygtk.org/index.py?req=show&file=faq04.015.htp) which has a 
> solution for this. But unfortunately it doesn't work. If I use "font = 
> widget.get_style().font", I get following error message: AttributeError: 
> 'gtk.Style' has no attribute 'font'.
>
> Is the FAQ outdated? What syntax should I use?
>
> Thank yo
Try widget.get_style().get_font().

-- 
Walter Leibbrandt                  http://translate.org.za/blogs/walter
Software Developer                                  +27 12 460 1095 (w)
Translate.org.za

Recent blogs:
* Virtaal's MVCisation
http://www.translate.org.za/blogs/walter/en/content/virtaals-mvcisation
* Things that changed the way I code
* Switching from Subversion to git




More information about the pygtk mailing list