*********************** Your mail has been scanned by InterScan VirusWall. ***********-***********
Nicodaemus wrote: > I have a simple program with a label on the main 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. It seems that the label ignores/don't get the size request of the window, even if I remove the window.set_size_request line and manually try to resize the window. The layout is drawn at the same size no matter what a window size is set. > 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. The label already fills the whole window. > 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 meet the left and right edges of the window (thereby also > reducing the number of lines of text). See at the code below for a workaround to achieve that. > > #!/usr/bin/env python > > import pygtk > pygtk.require('2.0') > import gtk > > class dislabel: > def __init__(self): > 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 )") > self.window.set_size_request(600, 200) > > 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) label.set_size_request(*self.window.get_size_request()) > label.set_line_wrap(True) > > self.window.add(label) > > self.window.show_all () > > def main(): > gtk.main() > return 0 > > if __name__ == "__main__": > dislabel() > main() > This could be Bug #318276 which got raised a month ago by myself. _______________________________________________ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list