[pygtk] Left justifying label text
mercado
python.dev.9 at gmail.com
Mon Mar 7 04:36:28 WST 2011
Hello Timo,
Yes, you're right. I must have missed those lines in the documentation.
Thanks again for your help.
On Sun, Mar 6, 2011 at 12:43 PM, Timo <timomlists at gmail.com> wrote:
> Have you read the docs about set_justify()? It has 3 important parts in your
> case.
> Quote [1]:
> |gtk.JUSTIFY_LEFT| is the default value when the widget is first created. If
> you want to set the alignment of the label as a whole, use the
> |gtk.Misc.set_alignment|()
> <http://library.gnome.org/devel/pygtk/stable/class-gtkmisc.html#method-gtkmisc--set-alignment>
> method instead. The |set_justify|()
> <http://library.gnome.org/devel/pygtk/stable/class-gtklabel.html#method-gtklabel--set-justify>
> has no effect on labels containing only a single line.
>
> * Your call to set_justify() does nothing, because you call the default
> value.
> * It wouldn't work anyway because you only have one line.
> * The solution is to use set_alignment()
>
> So replace label.set_justify(gtk.JUSTIFY_LEFT) with label.set_alignment(0,
> .5) and it should work.
>
> Cheers,
> Timo
>
> [1]
> http://library.gnome.org/devel/pygtk/stable/class-gtklabel.html#method-gtklabel--set-justify
More information about the pygtk
mailing list