I have a toplevel Gtk.Window which only child is a Gtk.Label.
If the width needed by the label to show its text is XXX pixels, I am not able to resize the top-level window with under XXX pixels. This happens if I set the size_request of the label to 5,5 too.
I'd like to be able to resize the window width under XXX pixels hiding part of the label text.
This is the code for testing: from gi.repository import Gtk
class Window(Gtk.Window):
def __init__(self):
super(Window,self).__init__()
self.label = Gtk.Label("long text label bla bla bla bla bla bla")
self.label.set_size_request(5,5)
self.add(self.label)
self.connect("delete-event",Gtk.main_quit)
self.show_all()
if __name__ == "__main__":
app = Window()
Gtk.main()
Try to change the ellipsize status of your label with gtk_set_ellipsize_status. The minimal requested size will then be the one of the ellipsis "…". Choose the right Pango ellipsize mode. Sad I can't find any PyGObject online documentation, so I had to link to the C and pyGTK ones, but you can find the PyGObject equivalent from that.