After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 711793 - set_size_request doesn't work in ScrolledWindow with PolicyType ALWAYS
set_size_request doesn't work in ScrolledWindow with PolicyType ALWAYS
Status: RESOLVED NOTABUG
Product: pygobject
Classification: Bindings
Component: gobject
unspecified
Other All
: Normal normal
: ---
Assigned To: Nobody's working on this now (help wanted and appreciated)
Python bindings maintainers
Depends on:
Blocks:
 
 
Reported: 2013-11-10 19:55 UTC by Xuan (Sean) Hu
Modified: 2013-11-12 08:06 UTC
See Also:
GNOME target: ---
GNOME version: ---



Description Xuan (Sean) Hu 2013-11-10 19:55:04 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?
Comment 1 Simon Feltman 2013-11-12 08:06:12 UTC
(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/