Hi everybody,

I am fairly new to pygtk, so please accept my apologies if this isn't a
question for this list, or if this is trivial.

It is a font related question and pertains to   pygtk 2.6.3 / gtk 2.8.9

In context of a larger application I do need to set and know the exact
width/height of a gtk.Entry(). Because alignment is important a
monospace
font is used. To set the width for the gtk.Entry() widget I use
entry.set_width_chars(n)  as shown below.

I hoped that the below code would open a gtk.Entry() displaying the full text -
instead the gtk.Entry() is shorter than the string, differently
depending on the
selected font size, almost as if the width of the gtk.Entry() widget was
computed for a different font.

Is this not the preferred/correct way to request the gtk.Entry() size? Should I
be using a different version of pygtk/gtk?

thank you for any help,

anton


#!/usr/bin/python

import pygtk
import pango
import gtk

w= gtk.Window()
e= gtk.Entry(65)
mono= pango.FontDescription('monospace 11')
e.modify_font(mono)
e.set_width_chars(65)
aText= 'ABCDEFGHIJ abcdefghij ---------- ririririri ---------- oooooooooo'
e.set_text(aText)
w.add(e)

w.show_all()
gtk.main()
_______________________________________________
pygtk mailing list   [email protected]
http://www.daa.com.au/mailman/listinfo/pygtk
Read the PyGTK FAQ: http://www.async.com.br/faq/pygtk/

Reply via email to