GNOME Bugzilla – Bug 711793
set_size_request doesn't work in ScrolledWindow with PolicyType ALWAYS
Last modified: 2013-11-12 08:06:12 UTC
I want to create an IconView in a scrolled window with vertical policy set to ALWAYS, but it doesn't work. When the PolicyType change to NEVER, the request size seems to work fine. There is a simple demo as following: ```python from gi.repository import Gtk win = Gtk.Window() sw = Gtk.ScrolledWindow() sw.set_policy(Gtk.PolicyType.NEVER, Gtk.PolicyType.ALWAYS) iv = Gtk.IconView() iv.set_size_request(640, 640) sw.add(iv) win.add(sw) win.connect("delete-event", Gtk.main_quit) win.show_all() Gtk.main() ``` Actually, the height of requested size doesn't work, but when change the vertical policy from ALWAYS to NEVER, it seems to work fine. Any suggestions to fix this problem?
(In reply to comment #0) > I want to create an IconView in a scrolled window with vertical policy set to > ALWAYS, but it doesn't work. When the PolicyType change to NEVER, the request > size seems to work fine. I see the vertical scrollbar when running the example. Perhaps it is a problem with the theme you are using? > Actually, the height of requested size doesn't work, but when change the > vertical policy from ALWAYS to NEVER, it seems to work fine. > Any suggestions to fix this problem? This has actually thrown me off in the past as well. Setting scrollbars to never seems to be interpreted by GTK+ as there is no scrolling and the widget should be the size of its contents (or size_request). Similar question here: http://python.6.x6.nabble.com/Hide-scrollbar-td1941146.html These docs might help a bit as well: https://developer.gnome.org/gtk3/3.10/GtkWidget.html#geometry-management Also note that problems of this nature generally won't be specific to Python (PyGObject is a wrapper around the underlying GTK+ library). For questions/help you are better off asking on a mailing list or in IRC: https://mail.gnome.org/mailman/listinfo/gtk-app-devel-list irc://irc.gnome.org/gtk+ Additionally you can you glade which can be a very useful tool for figuring out how to get what you want in terms of layout: https://glade.gnome.org/