Search code examples
gtkgtk3pygobject

Gtk.Label line wrap not working as expected


when width is sufficient to hold all characters

enter image description here

when characters exceed width

enter image description here

i have used set_line_wrap(True).There are two labels in each row as shown in picture, right label in each row has set_line_wrap(True), why is the label in the second row not starting from the beginning? when characters exceeds, i expect it to start from same position where it started before when characters were not exceeding.

Code:

 descriptionLabel=Gtk.Label(description)
 descriptionLabel.set_line_wrap(True)

Solution

  • Try setting halign to Gtk.AlignSTART and xalign to 0. This should ensure that both the label as a whole and each individual line starts at the very left of the available space.