I've got a set of labels in a flowbox, the problem is that I would like for these labels to be 96px wide at most. I've set label.set_ellipsize(True), but since the flowbox gives them as much room as they like they don't get ellipsized, even though I've set their size request to 96px wide.
I've tried every function I could find that seemed even tangentially related on all the widgets involved, but nothing seems to work.
the only workaround I did find was using set_min_children_per_line() but that requires calculating the number of children from the flowbox width which is dependent on the number of children per row, leading to a flowbox that gets really wide real quick.
I'm probably missing something obvious, but I've been bashing my head on this problem for days now.
I've made this testcase that exhibits the problem when amount of columns isn't divisible by two:
from gi.repository import Gtk as gtk
from gi.repository import Pango as pango
class Widget(gtk.VBox):
def __init__(self,label):
gtk.VBox.__init__(self)
image=gtk.Image.new_from_icon_name("image-missing",gtk.IconSize.DIALOG)
image.set_size_request(96,96)
self.add(image)
lbl=gtk.Label(label)
self.add(lbl)
class TestCase(gtk.Window):
def __init__(self):
gtk.Window.__init__(self)
lbl=gtk.Label("some text")
scrollbox=gtk.ScrolledWindow()
self.add(scrollbox)
flowbox=gtk.FlowBox()
scrollbox.add(flowbox)
for i in range(50):
w=Widget("longlabel"*5)
flowbox.add(w)
w=Widget("short")
flowbox.add(w)
if __name__=="__main__":
w=TestCase()
w.connect("delete-event",gtk.main_quit)
w.show_all()
gtk.main()