[pygtk] [Fwd: Label text does not span width of container]
johnanderson78 at dodo.com.au
Tue Nov 29 07:05:08 WST 2005
(the original query)
I have a simple program with a label on the main program window.
I place some text in the label and set the 'set_line_wrap' property of
the label to True.
However, when I run the script I notice that the text in the label does
not span the entire width of the window, as there are left and right
borders of space surrounding the label's text.
How do I alter the properties of the label so that the rendered text in
the label spans the entire width of the parent window/container?
I have tried using a v/hbox without success, and experimenting with
glade and various container configurations yields the same outcome.
I do not want to alter the width of the window to match the width of the
rendered text, but would prefer to have the width of the rendered text
'expanded' to meet the left and right edges of the window.
Any assistance will be appreciated.
self.window = gtk.Window(gtk.WINDOW_TOPLEVEL)
self.window.connect("destroy", lambda w: gtk.main_quit())
self.window.set_title("Label with set_line_wrap ( True )")
dastring = "I am feeling somewhat claustrophobic as "\
+"there are vertical borders of empty space to the "\
+"right and left of this label, even though this "\
+"label has been assigned the value set_line_wrap (True)."\
+" How do I remove these annoying spaces and have "\
+"the text of the label span the entire width "\
+"of the window/container?"
label = gtk.Label(dastring)
if __name__ == "__main__":
More information about the pygtk